From 4353240136606ce5d0535ca0cd061d6af1c746bc Mon Sep 17 00:00:00 2001 From: Chris Povirk Date: Thu, 5 Dec 2024 10:34:20 -0500 Subject: [PATCH] Allow `AsyncCacheLoader.bulk` to be used with nullable value types, too. --- .../benmanes/caffeine/cache/AsyncCacheLoader.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/AsyncCacheLoader.java b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/AsyncCacheLoader.java index d2ac373ad1..382f7b6c0b 100644 --- a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/AsyncCacheLoader.java +++ b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/AsyncCacheLoader.java @@ -139,8 +139,9 @@ default CompletableFuture asyncReload( * @return an asynchronous cache loader that delegates to the supplied {@code mappingFunction} * @throws NullPointerException if the mappingFunction is null */ - static AsyncCacheLoader bulk(Function, - ? extends Map> mappingFunction) { + static AsyncCacheLoader bulk( + Function, ? extends Map> + mappingFunction) { return CacheLoader.bulk(mappingFunction); } @@ -162,8 +163,12 @@ static AsyncCacheLoader bulk(Function, * @return an asynchronous cache loader that delegates to the supplied {@code mappingFunction} * @throws NullPointerException if the mappingFunction is null */ - static AsyncCacheLoader bulk(BiFunction, ? super Executor, - ? extends CompletableFuture>> mappingFunction) { + static AsyncCacheLoader bulk( + BiFunction< + ? super Set, + ? super Executor, + ? extends CompletableFuture>> + mappingFunction) { requireNonNull(mappingFunction); return new AsyncCacheLoader<>() { @Override public CompletableFuture asyncLoad(K key, Executor executor) {