diff --git a/guava/src/main/java/com/github/benmanes/caffeine/guava/CaffeinatedGuava.java b/guava/src/main/java/com/github/benmanes/caffeine/guava/CaffeinatedGuava.java index 59c2b455d7..391f89eb6a 100644 --- a/guava/src/main/java/com/github/benmanes/caffeine/guava/CaffeinatedGuava.java +++ b/guava/src/main/java/com/github/benmanes/caffeine/guava/CaffeinatedGuava.java @@ -44,7 +44,7 @@ private CaffeinatedGuava() {} @Nonnull public static Cache build( @Nonnull Caffeine builder) { - return new CaffeinatedGuavaCache(builder.build()); + return new CaffeinatedGuavaCache<>(builder.build()); } /** @@ -75,7 +75,7 @@ public static LoadingCache build( public static LoadingCache build( @Nonnull Caffeine builder, @Nonnull com.github.benmanes.caffeine.cache.CacheLoader loader) { - return new CaffeinatedGuavaLoadingCache(builder.build(loader)); + return new CaffeinatedGuavaLoadingCache<>(builder.build(loader)); } static boolean hasLoadAll(CacheLoader cacheLoader) { diff --git a/guava/src/main/java/com/github/benmanes/caffeine/guava/CaffeinatedGuavaCache.java b/guava/src/main/java/com/github/benmanes/caffeine/guava/CaffeinatedGuavaCache.java index 64e9d57bff..979f1fbb75 100644 --- a/guava/src/main/java/com/github/benmanes/caffeine/guava/CaffeinatedGuavaCache.java +++ b/guava/src/main/java/com/github/benmanes/caffeine/guava/CaffeinatedGuavaCache.java @@ -25,6 +25,9 @@ import java.util.concurrent.Callable; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.ExecutionException; +import java.util.function.BiFunction; +import java.util.function.Function; +import java.util.function.Predicate; import javax.annotation.Nullable; @@ -136,12 +139,32 @@ public ConcurrentMap asMap() { @Override public boolean containsKey(Object key) { return (key != null) && delegate().containsKey(key); } - @Override - public boolean containsValue(Object value) { + @Override public boolean containsValue(Object value) { return (value != null) && delegate().containsValue(value); } + @Override public void replaceAll(BiFunction function) { + delegate().replaceAll(function); + } + @Override public V computeIfAbsent(K key, Function mappingFunction) { + return delegate().computeIfAbsent(key, mappingFunction); + } + @Override public V computeIfPresent(K key, + BiFunction remappingFunction) { + return delegate().computeIfPresent(key, remappingFunction); + } + @Override public V compute(K key, + BiFunction remappingFunction) { + return delegate().compute(key, remappingFunction); + } + @Override public V merge(K key, V value, + BiFunction remappingFunction) { + return delegate().merge(key, value, remappingFunction); + } @Override public Set keySet() { return new ForwardingSet() { + @Override public boolean removeIf(Predicate filter) { + return delegate().removeIf(filter); + } @Override public boolean remove(Object o) { return (o != null) && delegate().remove(o); } @@ -152,6 +175,9 @@ public boolean containsValue(Object value) { } @Override public Collection values() { return new ForwardingCollection() { + @Override public boolean removeIf(Predicate filter) { + return delegate().removeIf(filter); + } @Override public boolean remove(Object o) { return (o != null) && delegate().remove(o); } @@ -168,6 +194,9 @@ public boolean containsValue(Object value) { @Override public boolean addAll(Collection> entry) { throw new UnsupportedOperationException(); } + @Override public boolean removeIf(Predicate> filter) { + return delegate().removeIf(filter); + } @Override public Iterator> iterator() { return delegate().stream().map(entry -> {