Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 13 for getIfPresent (0.09 sec)

  1. guava-tests/test/com/google/common/base/EnumsTest.java

      public void testGetIfPresent() {
        assertThat(Enums.getIfPresent(TestEnum.class, "CHEETO")).hasValue(TestEnum.CHEETO);
        assertThat(Enums.getIfPresent(TestEnum.class, "HONDA")).hasValue(TestEnum.HONDA);
        assertThat(Enums.getIfPresent(TestEnum.class, "POODLE")).hasValue(TestEnum.POODLE);
    
        assertThat(Enums.getIfPresent(TestEnum.class, "CHEETO")).isPresent();
        assertThat(Enums.getIfPresent(TestEnum.class, "HONDA")).isPresent();
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Wed May 29 16:29:37 UTC 2024
    - 8.7K bytes
    - Viewed (0)
  2. android/guava-tests/test/com/google/common/cache/AbstractLoadingCacheTest.java

                if (v == null) {
                  throw new ExecutionException(cause);
                }
                return v;
              }
    
              @Override
              public @Nullable Object getIfPresent(Object key) {
                return valueRef.get();
              }
            };
    
        UncheckedExecutionException expected =
            assertThrows(UncheckedExecutionException.class, () -> cache.getUnchecked(new Object()));
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Wed Sep 06 17:04:31 UTC 2023
    - 5K bytes
    - Viewed (0)
  3. guava-tests/benchmark/com/google/common/cache/MapMakerComparisonBenchmark.java

          map.get(TEST_KEY);
        }
      }
    
      @Benchmark
      void cacheBuilder_stats(int rep) {
        for (int i = 0; i < rep; i++) {
          cache.getIfPresent(TEST_KEY);
        }
      }
    
      @Benchmark
      void cacheBuilder(int rep) {
        for (int i = 0; i < rep; i++) {
          cacheNoStats.getIfPresent(TEST_KEY);
        }
      }
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Fri Aug 05 17:21:46 UTC 2022
    - 1.9K bytes
    - Viewed (0)
  4. guava-tests/test/com/google/common/cache/AbstractLoadingCacheTest.java

                if (v == null) {
                  throw new ExecutionException(cause);
                }
                return v;
              }
    
              @Override
              public @Nullable Object getIfPresent(Object key) {
                return valueRef.get();
              }
            };
    
        UncheckedExecutionException expected =
            assertThrows(UncheckedExecutionException.class, () -> cache.getUnchecked(new Object()));
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Wed Sep 06 17:04:31 UTC 2023
    - 5K bytes
    - Viewed (0)
  5. guava-tests/test/com/google/common/cache/CacheManualTest.java

        stats = cache.stats();
        assertEquals(3, stats.missCount());
        assertEquals(0, stats.loadSuccessCount());
        assertEquals(0, stats.loadExceptionCount());
        assertEquals(2, stats.hitCount());
        assertSame(two, cache.asMap().get(one));
        assertTrue(cache.asMap().containsKey(one));
        assertTrue(cache.asMap().containsValue(two));
    
        assertSame(one, cache.getIfPresent(two));
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Mon Dec 04 17:37:03 UTC 2017
    - 5.4K bytes
    - Viewed (0)
  6. android/guava/src/com/google/common/base/Enums.java

       * user input or falling back to a default enum constant. For example, {@code
       * Enums.getIfPresent(Country.class, countryInput).or(Country.DEFAULT);}
       *
       * @since 12.0
       */
      public static <T extends Enum<T>> Optional<T> getIfPresent(Class<T> enumClass, String value) {
        checkNotNull(enumClass);
        checkNotNull(value);
        return Platform.getEnumIfPresent(enumClass, value);
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Fri May 26 11:56:44 UTC 2023
    - 5K bytes
    - Viewed (0)
  7. android/guava/src/com/google/common/cache/AbstractCache.java

     *
     * <p>To implement a cache, the programmer needs only to extend this class and provide an
     * implementation for the {@link #put} and {@link #getIfPresent} methods. {@link #getAllPresent} is
     * implemented in terms of {@link #getIfPresent}; {@link #putAll} is implemented in terms of {@link
     * #put}, {@link #invalidateAll(Iterable)} is implemented in terms of {@link #invalidate}. The
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Tue Jun 15 18:00:07 UTC 2021
    - 9.1K bytes
    - Viewed (0)
  8. guava/src/com/google/common/base/Enums.java

       * user input or falling back to a default enum constant. For example, {@code
       * Enums.getIfPresent(Country.class, countryInput).or(Country.DEFAULT);}
       *
       * @since 12.0
       */
      public static <T extends Enum<T>> Optional<T> getIfPresent(Class<T> enumClass, String value) {
        checkNotNull(enumClass);
        checkNotNull(value);
        return Platform.getEnumIfPresent(enumClass, value);
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Fri May 26 11:56:44 UTC 2023
    - 5K bytes
    - Viewed (0)
  9. guava/src/com/google/common/cache/ForwardingCache.java

      protected ForwardingCache() {}
    
      @Override
      protected abstract Cache<K, V> delegate();
    
      /** @since 11.0 */
      @Override
      @CheckForNull
      public V getIfPresent(Object key) {
        return delegate().getIfPresent(key);
      }
    
      /** @since 11.0 */
      @Override
      public V get(K key, Callable<? extends V> valueLoader) throws ExecutionException {
        return delegate().get(key, valueLoader);
      }
    
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Tue Jun 15 18:00:07 UTC 2021
    - 3.6K bytes
    - Viewed (0)
  10. guava/src/com/google/common/cache/AbstractLoadingCache.java

     * implementation for the {@link #get(Object)} and {@link #getIfPresent} methods. {@link
     * #getUnchecked}, {@link #get(Object, Callable)}, and {@link #getAll} are implemented in terms of
     * {@code get}; {@link #getAllPresent} is implemented in terms of {@code getIfPresent}; {@link
     * #putAll} is implemented in terms of {@link #put}, {@link #invalidateAll(Iterable)} is implemented
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Sat Aug 06 17:12:03 UTC 2022
    - 2.7K bytes
    - Viewed (0)
Back to top