I wish to convert the following
enum Parameter {Foo, Bar, Baz};
Map<String, EnumMap<Parameter, String>> myMap = new HashMap(){{
put("KEY1", new EnumMap<>(Parameter.class) {{
put(Parameter.Foo, "BAD");
put(Parameter.Bar, "GOOD");
put(Parameter.Baz, "BAD");
}});
put("KEY2", new EnumMap<>(Parameter.class) {{
put(Parameter.Foo, "BAD");
put(Parameter.Bar, "GOOD");
put(Parameter.Baz, "GOOD");
}});
}};
into a filtered map where the filter will only contain either the
Map<String, List<Entry<Parameter, String>>> mapList
Where the resultant list should contain the rows with "GOOD" as the filter criteria.
I cannot figure out the correct stream syntax to do this, I know its along the following lines:
Map<String, List<Entry<Parameter, String>>> mapList =
myMap.entrySet().stream().groupingBy(e -> e.getKey()).collect(Collectors.toMap(????)
Servicewith a name and a list of things (needs a better name) that would contain the device type, the address, etc.