Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 54 for putIfAbsent (0.23 sec)

  1. android/guava/src/com/google/common/util/concurrent/AtomicLongMap.java

       * intermediate zero-state. Ways we could deal with this are:
       *
       * - Don't define any of the ConcurrentMap operations. This is the current state of affairs.
       *
       * - Define putIfAbsent and replace as treating zero and absent identically (as currently
       *   implemented below). This is a bit surprising with putIfAbsent, which really becomes
       *   putIfZero.
    Java
    - Registered: Fri Apr 26 12:43:10 GMT 2024
    - Last Modified: Mon Apr 01 16:15:01 GMT 2024
    - 14.1K bytes
    - Viewed (0)
  2. 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(),
    Java
    - Registered: Fri Apr 26 12:43:10 GMT 2024
    - Last Modified: Mon Jun 26 18:17:52 GMT 2023
    - 4.8K bytes
    - Viewed (0)
  3. guava-testlib/src/com/google/common/collect/testing/testers/ConcurrentMapPutIfAbsentTester.java

        assertNull("putIfAbsent(notPresent, value) should return null", putIfAbsent(e3()));
        expectAdded(e3());
      }
    
      @MapFeature.Require(SUPPORTS_PUT)
      @CollectionSize.Require(absent = ZERO)
      public void testPutIfAbsent_supportedPresent() {
        assertEquals(
            "putIfAbsent(present, value) should return existing value",
            v0(),
            getMap().putIfAbsent(k0(), v3()));
        expectUnchanged();
      }
    Java
    - Registered: Fri Apr 26 12:43:10 GMT 2024
    - Last Modified: Wed Feb 21 16:49:06 GMT 2024
    - 4.8K bytes
    - Viewed (0)
  4. android/guava-testlib/src/com/google/common/collect/testing/testers/ConcurrentMapPutIfAbsentTester.java

        assertNull("putIfAbsent(notPresent, value) should return null", putIfAbsent(e3()));
        expectAdded(e3());
      }
    
      @MapFeature.Require(SUPPORTS_PUT)
      @CollectionSize.Require(absent = ZERO)
      public void testPutIfAbsent_supportedPresent() {
        assertEquals(
            "putIfAbsent(present, value) should return existing value",
            v0(),
            getMap().putIfAbsent(k0(), v3()));
        expectUnchanged();
      }
    Java
    - Registered: Fri Apr 26 12:43:10 GMT 2024
    - Last Modified: Wed Feb 21 16:49:06 GMT 2024
    - 4.8K bytes
    - Viewed (0)
  5. 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
    Java
    - Registered: Fri Apr 26 12:43:10 GMT 2024
    - Last Modified: Wed Sep 06 17:04:31 GMT 2023
    - 14.2K bytes
    - Viewed (0)
  6. 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);
    Java
    - Registered: Fri Apr 12 12:43:09 GMT 2024
    - Last Modified: Tue Feb 13 14:28:25 GMT 2024
    - 17.4K bytes
    - Viewed (0)
  7. maven-core/src/main/java/org/apache/maven/project/Graph.java

        }
    
        private static List<String> visitAll(
                Collection<Vertex> children, Map<Vertex, DfsState> stateMap, List<String> list) {
            for (Vertex v : children) {
                DfsState state = stateMap.putIfAbsent(v, DfsState.VISITING);
                if (state == null) {
                    visitAll(v.children, stateMap, list);
                    stateMap.put(v, DfsState.VISITED);
                    list.add(v.label);
                }
            }
    Java
    - Registered: Sun Apr 21 03:35:09 GMT 2024
    - Last Modified: Fri Sep 22 06:02:04 GMT 2023
    - 3.9K bytes
    - Viewed (0)
  8. guava/src/com/google/common/collect/JdkBackedImmutableBiMap.java

          entryArray[i] = e;
          V oldValue = forwardDelegate.putIfAbsent(e.getKey(), e.getValue());
          if (oldValue != null) {
            throw conflictException("key", e.getKey() + "=" + oldValue, entryArray[i]);
          }
          K oldKey = backwardDelegate.putIfAbsent(e.getValue(), e.getKey());
          if (oldKey != null) {
    Java
    - Registered: Fri Apr 05 12:43:09 GMT 2024
    - Last Modified: Thu Nov 30 21:54:06 GMT 2023
    - 4.6K bytes
    - Viewed (0)
  9. 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"));
        assertNull(map.putIfAbsent("bar", 3));
        assertEquals(Integer.valueOf(3), map.get("bar"));
      }
    
      public void testRemove() {
        TestMap map = new TestMap();
        map.put("foo", 1);
    Java
    - Registered: Fri Apr 19 12:43:09 GMT 2024
    - Last Modified: Mon Dec 04 17:37:03 GMT 2017
    - 2.4K bytes
    - Viewed (0)
  10. maven-core/src/main/java/org/apache/maven/internal/impl/Graph.java

        }
    
        private static List<String> visitAll(
                Collection<Vertex> children, Map<Vertex, DfsState> stateMap, List<String> list) {
            for (Vertex v : children) {
                DfsState state = stateMap.putIfAbsent(v, DfsState.VISITING);
                if (state == null) {
                    visitAll(v.children, stateMap, list);
                    stateMap.put(v, DfsState.VISITED);
                    list.add(v.label);
                }
            }
    Java
    - Registered: Sun Apr 21 03:35:09 GMT 2024
    - Last Modified: Fri Apr 12 10:50:18 GMT 2024
    - 4.5K bytes
    - Viewed (0)
Back to top