Can I build a Map more succinctly? Sort of like Sets.cartesianProduct(set1, set2, ... )
, I'd like a one-liner to build a map with empty, initialized, mutable Lists. The following code is just for illustration.
Map<MyEnumeration, List<String>> answer = new HashMap<>();
for (MyEnumeration enum : MyEnumeration.values()) {
answer.put(enum, new ArrayList<String>());
}
I like other people's [tested] code. This isn't quite right, this is really about how to instantiate things and despite the title, this is really a question about generics.