1818
1919import java .util .List ;
2020import java .util .Map ;
21+ import java .util .Set ;
2122import java .util .concurrent .CompletionStage ;
2223
2324/**
24- * A function that is invoked for batch loading a map of of data values indicated by the provided list of keys. The
25+ * A function that is invoked for batch loading a map of of data values indicated by the provided set of keys. The
2526 * function returns a promise of a map of results of individual load requests.
2627 * <p>
2728 * There are a few constraints that must be upheld:
2829 * <ul>
2930 * <li>The keys MUST be able to be first class keys in a Java map. Get your equals() and hashCode() methods in order</li>
30- * <li>The caller of the {@link org.dataloader.DataLoader} that uses this batch loader function MUSt be able to cope with
31+ * <li>The caller of the {@link org.dataloader.DataLoader} that uses this batch loader function MUST be able to cope with
3132 * null values coming back as results
3233 * </li>
33- * <li>The function MUST be resilient to the same key being presented twice.</li>
3434 * </ul>
3535 * <p>
3636 * This form is useful when you don't have a 1:1 mapping of keys to values or when null is an acceptable value for a missing value.
5050 * <p>
5151 * This means that if 10 keys are asked for then {@link DataLoader#dispatch()} will return a promise of 10 value results and each
5252 * of the {@link org.dataloader.DataLoader#load(Object)} will complete with a value, null or an exception.
53- * <p>
54- * When caching is disabled, its possible for the same key to be presented in the list of keys more than once. Your map
55- * batch loader function needs to be resilient to this situation.
5653 *
5754 * @param <K> type parameter indicating the type of keys to use for data load requests.
5855 * @param <V> type parameter indicating the type of values returned
@@ -63,10 +60,10 @@ public interface MappedBatchLoader<K, V> {
6360 /**
6461 * Called to batch load the provided keys and return a promise to a map of values.
6562 *
66- * @param keys the collection of keys to load
63+ * @param keys the set of keys to load
6764 *
6865 * @return a promise to a map of values for those keys
6966 */
7067 @ SuppressWarnings ("unused" )
71- CompletionStage <Map <K , V >> load (List <K > keys );
68+ CompletionStage <Map <K , V >> load (Set <K > keys );
7269}
0 commit comments