- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 27 for putIfAbsent (0.06 sec)
-
guava-testlib/src/com/google/common/collect/testing/testers/MapPutIfAbsentTester.java
public void testPutIfAbsent_supportedAbsent() { assertNull( "putIfAbsent(notPresent, value) should return null", getMap().putIfAbsent(k3(), v3())); expectAdded(e3()); } @MapFeature.Require(SUPPORTS_PUT) @CollectionSize.Require(absent = ZERO) public void testPutIfAbsent_supportedPresent() { assertEquals( "putIfAbsent(present, value) should return existing value", v0(),
Registered: Fri Dec 26 12:43:10 UTC 2025 - Last Modified: Tue Sep 16 02:04:51 UTC 2025 - 5.3K bytes - Viewed (0) -
android/guava-testlib/src/com/google/common/collect/testing/testers/MapPutIfAbsentTester.java
public void testPutIfAbsent_supportedAbsent() { assertNull( "putIfAbsent(notPresent, value) should return null", getMap().putIfAbsent(k3(), v3())); expectAdded(e3()); } @MapFeature.Require(SUPPORTS_PUT) @CollectionSize.Require(absent = ZERO) public void testPutIfAbsent_supportedPresent() { assertEquals( "putIfAbsent(present, value) should return existing value", v0(),
Registered: Fri Dec 26 12:43:10 UTC 2025 - Last Modified: Tue Sep 16 02:04:51 UTC 2025 - 5.4K bytes - Viewed (0) -
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 bothRegistered: Fri Dec 26 12:43:10 UTC 2025 - Last Modified: Mon Dec 08 22:42:14 UTC 2025 - 16.3K bytes - Viewed (0) -
android/guava-tests/test/com/google/common/util/concurrent/AtomicLongMapTest.java
for (int i = 0; i < ITERATIONS; i++) { long before = map.get(key); long result = map.putIfAbsent(key, newValue); long after = map.get(key); assertEquals(before, result); assertEquals(before == 0 ? newValue : before, after); map.remove(key); before = map.get(key); result = map.putIfAbsent(key, newValue); after = map.get(key); assertEquals(0, before);
Registered: Fri Dec 26 12:43:10 UTC 2025 - Last Modified: Thu Aug 07 16:05:33 UTC 2025 - 17.5K bytes - Viewed (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 }Registered: Fri Dec 26 12:43:10 UTC 2025 - Last Modified: Mon Dec 08 22:42:14 UTC 2025 - 22.3K bytes - Viewed (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);
Registered: Fri Dec 26 12:43:10 UTC 2025 - Last Modified: Tue Oct 28 16:03:47 UTC 2025 - 2.5K bytes - Viewed (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);
Registered: Fri Dec 26 12:43:10 UTC 2025 - Last Modified: Tue Oct 28 16:03:47 UTC 2025 - 13.3K bytes - Viewed (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(
Registered: Sun Dec 28 03:35:09 UTC 2025 - Last Modified: Mon Sep 29 15:32:43 UTC 2025 - 4.6K bytes - Viewed (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
Registered: Fri Dec 26 12:43:10 UTC 2025 - Last Modified: Tue Sep 30 22:03:28 UTC 2025 - 15.7K bytes - Viewed (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) -> {Registered: Fri Dec 26 12:43:10 UTC 2025 - Last Modified: Fri Oct 10 23:13:45 UTC 2025 - 11.7K bytes - Viewed (0)