Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 21 for getIfPresent (0.1 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 Dec 26 12:43:10 UTC 2025
    - Last Modified: Thu Dec 11 20:07:52 UTC 2025
    - 8.3K bytes
    - Viewed (0)
  2. 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 Dec 26 12:43:10 UTC 2025
    - Last Modified: Tue Sep 30 22:03:28 UTC 2025
    - 5K bytes
    - Viewed (0)
  3. android/guava-tests/test/com/google/common/cache/CacheBuilderGwtTest.java

        fakeTicker.advance(999, MILLISECONDS);
        assertThat(cache.getIfPresent(10)).isEqualTo(100);
        assertThat(cache.getIfPresent(20)).isEqualTo(200);
        assertThat(cache.getIfPresent(4)).isEqualTo(2);
    
        fakeTicker.advance(2, MILLISECONDS);
        assertThat(cache.getIfPresent(10)).isNull();
        assertThat(cache.getIfPresent(20)).isNull();
        assertThat(cache.getIfPresent(4)).isNull();
    
        cache.put(10, 20);
    Registered: Fri Dec 26 12:43:10 UTC 2025
    - Last Modified: Tue Sep 30 22:03:28 UTC 2025
    - 14.8K bytes
    - Viewed (0)
  4. guava-tests/test/com/google/common/cache/AbstractCacheTest.java

            new AbstractCache<Object, Object>() {
              @Override
              public @Nullable Object getIfPresent(Object key) {
                return valueRef.get();
              }
            };
    
        assertThat(cache.getIfPresent(new Object())).isNull();
    
        Object newValue = new Object();
        valueRef.set(newValue);
        assertThat(cache.getIfPresent(new Object())).isSameInstanceAs(newValue);
      }
    
      public void testGetAllPresent_empty() {
    Registered: Fri Dec 26 12:43:10 UTC 2025
    - Last Modified: Tue Sep 30 22:03:28 UTC 2025
    - 6.4K bytes
    - Viewed (0)
  5. 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 Dec 26 12:43:10 UTC 2025
    - Last Modified: Tue Jul 01 13:41:58 UTC 2025
    - 4.8K bytes
    - Viewed (0)
  6. src/main/java/org/codelibs/fess/helper/CrawlerStatsHelper.java

         */
        public void record(final Object keyObj, final String action) {
            getCacheKey(keyObj).ifPresent(key -> {
                try {
                    final StatsObject data = statsCache.getIfPresent(key);
                    if (data != null) {
                        data.put(escapeValue(action), getCurrentTimeMillis());
                    }
                } catch (final Exception e) {
    Registered: Sat Dec 20 09:19:18 UTC 2025
    - Last Modified: Thu Aug 07 03:06:29 UTC 2025
    - 17.4K 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 Dec 26 12:43:10 UTC 2025
    - Last Modified: Tue May 13 17:27:14 UTC 2025
    - 9.1K bytes
    - Viewed (0)
  8. guava-tests/test/com/google/common/cache/LocalCacheMapComputeTest.java

        doParallelCacheOp(
            count,
            n -> {
              cache.asMap().computeIfPresent(key, (k, v) -> v + delimiter + n);
            });
        assertThat(cache.size()).isEqualTo(1);
        assertThat(cache.getIfPresent(key).split(delimiter)).hasLength(count + 1);
      }
    
      public void testComputeIfPresentRemove() {
        List<RemovalNotification<Integer, Integer>> notifications = new ArrayList<>();
        Cache<Integer, Integer> cache =
    Registered: Fri Dec 26 12:43:10 UTC 2025
    - Last Modified: Tue Sep 30 22:03:28 UTC 2025
    - 7K 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
      public @Nullable 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 Dec 26 12:43:10 UTC 2025
    - Last Modified: Sat Jan 18 02:54:30 UTC 2025
    - 3.6K bytes
    - Viewed (0)
  10. 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 Dec 26 12:43:10 UTC 2025
    - Last Modified: Tue May 13 17:27:14 UTC 2025
    - 9.1K bytes
    - Viewed (0)
Back to top