Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 22 for putIfAbsent (2.56 sec)

  1. 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 both
    Registered: Fri Dec 26 12:43:10 UTC 2025
    - Last Modified: Mon Dec 08 22:42:14 UTC 2025
    - 16.3K bytes
    - Viewed (0)
  2. 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)
  3. 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)
  4. 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)
  5. 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)
  6. 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)
  7. 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)
  8. 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);
    Registered: Fri Dec 26 12:43:10 UTC 2025
    - Last Modified: Tue Sep 30 22:03:28 UTC 2025
    - 14.8K bytes
    - Viewed (0)
  9. impl/maven-core/src/main/java/org/apache/maven/plugin/version/internal/DefaultPluginVersionResolver.java

                            request.getGroupId(),
                            request.getArtifactId(),
                            result.getVersion(),
                            result.getRepository());
    
                    cache.putIfAbsent(key, result);
                } else {
                    logger.debug(
                            "Reusing cached resolved plugin version for {}:{} to {} from POM {}",
                            request.getGroupId(),
    Registered: Sun Dec 28 03:35:09 UTC 2025
    - Last Modified: Wed Jan 29 08:17:07 UTC 2025
    - 17.6K bytes
    - Viewed (0)
  10. 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.
         */
    Registered: Sun Dec 28 03:35:09 UTC 2025
    - Last Modified: Wed Nov 12 14:59:46 UTC 2025
    - 12.3K bytes
    - Viewed (0)
Back to top