I am trying to make a Map<BooleanSupplier, List<String>>
as part of my flow I make the suppliers and then try to use an immutable map builder.
Something like:
//Build up BooleanSuppliers
Map<BooleanSupplier, List<String>> bsList = ImmutableMap.builder()
.put(bs1, Collections.singletonList("bs1string"))
.put(bs2, Arrays.asList("bs4","bs6"))
....
.build();
The problem is that intellij says that the types are not convertible even when I do an explicit cast because the ImmutableMap is of type <Object, Object>
. Is there a way to explicitly cast or initialize the immutable map builder to be of type ImmutableMap<BooleanSupplier, List<String>>
?
Specify the generic type explicitely when calling builder()
:
Map<BooleanSupplier, List<String>> bsList =
ImmutableMap.<BooleanSupplier, List<String>>builder()
.put(...)
.build();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With