18
18
19
19
import java .util .List ;
20
20
import java .util .Map ;
21
+ import java .util .Set ;
21
22
import java .util .concurrent .CompletionStage ;
22
23
23
24
/**
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
25
26
* function returns a promise of a map of results of individual load requests.
26
27
* <p>
27
28
* There are a few constraints that must be upheld:
28
29
* <ul>
29
30
* <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
31
32
* null values coming back as results
32
33
* </li>
33
- * <li>The function MUST be resilient to the same key being presented twice.</li>
34
34
* </ul>
35
35
* <p>
36
36
* 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.
50
50
* <p>
51
51
* This means that if 10 keys are asked for then {@link DataLoader#dispatch()} will return a promise of 10 value results and each
52
52
* 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.
56
53
*
57
54
* @param <K> type parameter indicating the type of keys to use for data load requests.
58
55
* @param <V> type parameter indicating the type of values returned
@@ -63,10 +60,10 @@ public interface MappedBatchLoader<K, V> {
63
60
/**
64
61
* Called to batch load the provided keys and return a promise to a map of values.
65
62
*
66
- * @param keys the collection of keys to load
63
+ * @param keys the set of keys to load
67
64
*
68
65
* @return a promise to a map of values for those keys
69
66
*/
70
67
@ SuppressWarnings ("unused" )
71
- CompletionStage <Map <K , V >> load (List <K > keys );
68
+ CompletionStage <Map <K , V >> load (Set <K > keys );
72
69
}
0 commit comments