- Sort Score
- Num 10 results
- Language All
Results 1 - 10 of 54 for computeIfAbsent (0.08 seconds)
The search processing time has exceeded the limit. The displayed results may be partial.
-
guava-tests/test/com/google/common/cache/LocalCacheMapComputeTest.java
doParallelCacheOp(count, n -> cache.asMap().computeIfAbsent(key, k -> "value" + n)); assertThat(cache.size()).isEqualTo(1); } public void testComputeIfAbsentEviction() { // b/80241237 Cache<String, String> c = CacheBuilder.newBuilder().maximumSize(1).build(); assertThat(c.asMap().computeIfAbsent("hash-1", k -> "")).isEqualTo(""); assertThat(c.asMap().computeIfAbsent("hash-1", k -> "")).isEqualTo("");
Created: 2026-04-03 12:43 - Last Modified: 2026-03-18 18:06 - 6.4K bytes - Click Count (0) -
android/guava-testlib/src/com/google/common/collect/testing/testers/MapComputeIfAbsentTester.java
@MapFeature.Require(SUPPORTS_PUT) public void testComputeIfAbsent_supportedAbsent() { assertEquals( "computeIfAbsent(notPresent, function) should return new value", v3(), getMap() .computeIfAbsent( k3(), k -> { assertEquals(k3(), k); return v3(); }));
Created: 2026-04-03 12:43 - Last Modified: 2024-10-31 14:51 - 6.7K bytes - Click Count (0) -
okhttp/src/commonJvmAndroid/kotlin/okhttp3/Call.kt
* [computeIfAbsent] implementation. No locks are held while calling this function. */ fun <T : Any> tag( type: KClass<T>, computeIfAbsent: () -> T, ): T /** * Returns the tag attached with [type] as a key. If it is absent, then [computeIfAbsent] is * called and that value is both inserted and returned. *
Created: 2026-04-03 11:42 - Last Modified: 2025-11-05 18:28 - 6.8K bytes - Click Count (0) -
build-logic/binary-compatibility/src/main/kotlin/gradlebuild/binarycompatibility/sources/SourcesRepository.kt
fun <T : Any?> executeQuery(apiSourceFile: ApiSourceFile.Java, query: JavaSourceQuery<T>): T = openJavaCompilationUnitsByFile .computeIfAbsent(apiSourceFile.currentFile) { JavaParser().parse(it).getResult().get() } .accept(query.visitor, null) ?: query.defaultValueCreated: 2026-04-01 11:36 - Last Modified: 2025-04-28 14:56 - 4.1K bytes - Click Count (0) -
okhttp-testing-support/src/main/kotlin/okhttp3/FailingCall.kt
override fun <T> tag(type: Class<out T>): T? = error("unexpected") override fun <T : Any> tag( type: KClass<T>, computeIfAbsent: () -> T, ): T = error("unexpected") override fun <T : Any> tag( type: Class<T>, computeIfAbsent: () -> T, ): T = error("unexpected") override fun clone(): Call = error("unexpected")
Created: 2026-04-03 11:42 - Last Modified: 2025-11-05 18:28 - 1.6K bytes - Click Count (0) -
impl/maven-core/src/main/java/org/apache/maven/graph/FilteredProjectDependencyGraph.java
public List<MavenProject> getDownstreamProjects(MavenProject project, boolean transitive) { Key key = new Key(project, transitive, false); // Do not use computeIfAbsent here, as the computation is recursive // and this is not supported by computeIfAbsent. List<MavenProject> list = cache.get(key); if (list == null) {
Created: 2026-04-05 03:35 - Last Modified: 2025-06-19 16:34 - 6.4K bytes - Click Count (0) -
okhttp/src/commonJvmAndroid/kotlin/okhttp3/internal/connection/RealCall.kt
override fun <T : Any> tag( type: KClass<T>, computeIfAbsent: () -> T, ): T = tags.computeIfAbsent(type, computeIfAbsent) override fun <T : Any> tag( type: Class<T>, computeIfAbsent: () -> T, ): T = tags.computeIfAbsent(type.kotlin, computeIfAbsent) @SuppressWarnings("CloneDoesntCallSuperClone") // We are a final type & this saves clearing state.
Created: 2026-04-03 11:42 - Last Modified: 2026-01-11 12:06 - 19.5K bytes - Click Count (0) -
okhttp/src/jvmTest/kotlin/okhttp3/internal/TagsTest.kt
val tags = EmptyTags val atomicTags = AtomicReference<Tags>(tags) val result = atomicTags.computeIfAbsent(String::class) { // 'Race' by making another computeIfAbsent call. In practice this would be another thread. assertThat(atomicTags.computeIfAbsent(Integer::class) { 5 as Integer }).isEqualTo(5) "a" } assertThat(result).isEqualTo("a")Created: 2026-04-03 11:42 - Last Modified: 2025-10-24 11:37 - 7.1K bytes - Click Count (0) -
compat/maven-model/src/test/java/org/apache/maven/model/pom/PomMemoryAnalyzer.java
} return plural; } private void recordString(String path, String value) { pathStats .computeIfAbsent(path, k -> new HashMap<>()) .computeIfAbsent(value, k -> new StringStats()) .recordOccurrence(value); } List<PathAnalysis> getPathAnalysisSorted() {Created: 2026-04-05 03:35 - Last Modified: 2025-03-21 04:56 - 13.4K bytes - Click Count (0) -
impl/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/multithreaded/SmartProjectComparator.java
Long existingWeight = projectWeights.get(project); if (existingWeight != null) { return existingWeight; } // Calculate weight without using computeIfAbsent to avoid recursive update issues long weight = calculateWeight(project); // Use putIfAbsent to handle concurrent access safely Long previousWeight = projectWeights.putIfAbsent(project, weight);
Created: 2026-04-05 03:35 - Last Modified: 2025-08-06 12:03 - 4.6K bytes - Click Count (0)