17
17
* @param <V> the value element type
18
18
* @param <M> the resulting map type
19
19
*/
20
- public final class ToMap <K , V , M extends Map <K , V >> implements Fn2 <Supplier <M >, Iterable <Map .Entry <K , V >>, M > {
20
+ public final class ToMap <K , V , M extends Map <K , V >> implements Fn2 <Supplier <M >, Iterable <? extends Map .Entry <K , V >>, M > {
21
21
22
22
private static final ToMap INSTANCE = new ToMap <>();
23
23
24
24
private ToMap () {
25
25
}
26
26
27
27
@ Override
28
- public M apply (Supplier <M > mSupplier , Iterable <Map .Entry <K , V >> entries ) {
28
+ public M apply (Supplier <M > mSupplier , Iterable <? extends Map .Entry <K , V >> entries ) {
29
29
return foldLeft ((m , kv ) -> {
30
30
m .put (kv .getKey (), kv .getValue ());
31
31
return m ;
@@ -37,11 +37,12 @@ public static <K, V, M extends Map<K, V>> ToMap<K, V, M> toMap() {
37
37
return INSTANCE ;
38
38
}
39
39
40
- public static <K , V , M extends Map <K , V >> Fn1 <Iterable <Map .Entry <K , V >>, M > toMap (Supplier <M > mSupplier ) {
40
+ public static <K , V , M extends Map <K , V >> Fn1 <Iterable <? extends Map .Entry <K , V >>, M > toMap (Supplier <M > mSupplier ) {
41
41
return ToMap .<K , V , M >toMap ().apply (mSupplier );
42
42
}
43
43
44
- public static <K , V , M extends Map <K , V >> M toMap (Supplier <M > mSupplier , Iterable <Map .Entry <K , V >> entries ) {
44
+ public static <K , V , M extends Map <K , V >> M toMap (Supplier <M > mSupplier ,
45
+ Iterable <? extends Map .Entry <K , V >> entries ) {
45
46
return toMap (mSupplier ).apply (entries );
46
47
}
47
48
}
0 commit comments