- Sort Score
- Num 10 results
- Language All
Results 1 - 10 of 12 for putIfAbsent (0.1 seconds)
-
android/guava-tests/test/com/google/common/collect/ConcurrentHashMultisetTest.java
// since get returned null, try a putIfAbsent; that fails due to a simulated race when(backingMap.putIfAbsent(eq(KEY), isA(AtomicInteger.class))).thenReturn(existingZero); // since the putIfAbsent returned a zero, we'll try to replace... when(backingMap.replace(eq(KEY), eq(existingZero), isA(AtomicInteger.class))).thenReturn(false); // ...and then putIfAbsent. Simulate failure on bothCreated: Fri Dec 26 12:43:10 GMT 2025 - Last Modified: Mon Dec 08 22:42:14 GMT 2025 - 16.3K bytes - Click Count (0) -
android/guava/src/com/google/common/collect/ConcurrentHashMultiset.java
while (true) { AtomicInteger existingCounter = safeGet(countMap, element); if (existingCounter == null) { existingCounter = countMap.putIfAbsent(element, new AtomicInteger(occurrences)); if (existingCounter == null) { return 0; } // existingCounter != null: fall through to operate against the existing AtomicInteger }Created: Fri Dec 26 12:43:10 GMT 2025 - Last Modified: Mon Dec 08 22:42:14 GMT 2025 - 22.3K bytes - Click Count (0) -
android/guava-tests/test/com/google/common/collect/ForwardingConcurrentMapTest.java
} } public void testPutIfAbsent() { TestMap map = new TestMap(); map.put("foo", 1); assertEquals(Integer.valueOf(1), map.putIfAbsent("foo", 2)); assertEquals(Integer.valueOf(1), map.get("foo")); assertThat(map.putIfAbsent("bar", 3)).isNull(); assertEquals(Integer.valueOf(3), map.get("bar")); } public void testRemove() { TestMap map = new TestMap(); map.put("foo", 1);
Created: Fri Dec 26 12:43:10 GMT 2025 - Last Modified: Tue Oct 28 16:03:47 GMT 2025 - 2.5K bytes - Click Count (0) -
android/guava-tests/test/com/google/common/cache/LocalLoadingCacheTest.java
map.putAll(ImmutableMap.of(two, three)); assertThat(map.get(two)).isSameInstanceAs(three); assertThat(map.putIfAbsent(one, three)).isSameInstanceAs(two); assertThat(map.get(one)).isSameInstanceAs(two); assertThat(map.putIfAbsent(three, one)).isNull(); assertThat(map.get(three)).isSameInstanceAs(one); assertThat(map.replace(one, three)).isSameInstanceAs(two);
Created: Fri Dec 26 12:43:10 GMT 2025 - Last Modified: Tue Oct 28 16:03:47 GMT 2025 - 13.3K bytes - Click Count (0) -
impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/PrecedenceCoreExtensionSelector.java
String key = coreExtension.getGroupId() + ":" + coreExtension.getArtifactId(); CoreExtension conflict = selectedExtensions.putIfAbsent(key, coreExtension); if (conflict != null && !Objects.equals(coreExtension.getVersion(), conflict.getVersion())) { conflicts.add(String.format(
Created: Sun Dec 28 03:35:09 GMT 2025 - Last Modified: Mon Sep 29 15:32:43 GMT 2025 - 4.6K bytes - Click Count (0) -
guava/src/com/google/common/util/concurrent/AtomicLongMap.java
* zero, associate it with {@code newValue}. Returns the previous value associated with {@code * key}, or zero if there was no mapping for {@code key}. */ long putIfAbsent(K key, long newValue) { AtomicBoolean noValue = new AtomicBoolean(false); Long result = map.compute( key, (K k, @Nullable Long oldValue) -> {Created: Fri Dec 26 12:43:10 GMT 2025 - Last Modified: Fri Oct 10 23:13:45 GMT 2025 - 11.7K bytes - Click Count (0) -
android/guava-tests/test/com/google/common/cache/PopulatedCachesTest.java
Entry<Object, Object> entry = warmed.get(i - WARMUP_MIN); Object newValue = new Object(); assertThat(cache.asMap().putIfAbsent(entry.getKey(), newValue)) .isSameInstanceAs(entry.getValue()); Object newKey = new Object(); assertThat(cache.asMap().putIfAbsent(newKey, entry.getValue())).isNull(); // this getUnchecked() call shouldn't be a cache miss; verified below
Created: Fri Dec 26 12:43:10 GMT 2025 - Last Modified: Tue Sep 30 22:03:28 GMT 2025 - 15.7K bytes - Click Count (0) -
guava-tests/test/com/google/common/cache/PopulatedCachesTest.java
Entry<Object, Object> entry = warmed.get(i - WARMUP_MIN); Object newValue = new Object(); assertThat(cache.asMap().putIfAbsent(entry.getKey(), newValue)) .isSameInstanceAs(entry.getValue()); Object newKey = new Object(); assertThat(cache.asMap().putIfAbsent(newKey, entry.getValue())).isNull(); // this getUnchecked() call shouldn't be a cache miss; verified below
Created: Fri Dec 26 12:43:10 GMT 2025 - Last Modified: Tue Sep 30 22:03:28 GMT 2025 - 15.7K bytes - Click Count (0) -
android/guava-tests/test/com/google/common/cache/CacheBuilderGwtTest.java
assertThat(cache.getIfPresent(10)).isEqualTo(50); assertThat(asMap.get(10)).isEqualTo(50); assertThat(cache.getIfPresent(2)).isNull(); assertThat(asMap.get(2)).isNull(); asMap.putIfAbsent(2, 20); asMap.putIfAbsent(10, 20); assertThat(cache.getIfPresent(2)).isEqualTo(20); assertThat(asMap.get(2)).isEqualTo(20); assertThat(cache.getIfPresent(10)).isEqualTo(50);
Created: Fri Dec 26 12:43:10 GMT 2025 - Last Modified: Tue Sep 30 22:03:28 GMT 2025 - 14.8K bytes - Click Count (0) -
impl/maven-core/src/main/java/org/apache/maven/configuration/internal/EnhancedCompositeBeanHelper.java
if (!Modifier.isStatic(method.getModifiers()) && method.getParameterCount() == 1) { Type[] paramTypes = method.getGenericParameterTypes(); methodMap.putIfAbsent(method.getName(), new MethodInfo(method, paramTypes[0])); } } return methodMap; } /** * Check if method is compatible with value type. */
Created: Sun Dec 28 03:35:09 GMT 2025 - Last Modified: Wed Nov 12 14:59:46 GMT 2025 - 12.3K bytes - Click Count (0)