Stop using raw types!
These are mySupplier
without raw types:
static EnumMap<LifeCycle, Set<TestGroupBy>> mySupplier() {
return new EnumMap<>(LifeCycle.class);
}
The key type EnumMap
should be an enum type, so you should use LifeCycle
as the first argument. The second argument is what the collector you use at the end returns. You used toSet
here, so I assume you need a kit TestGroupBy
.
, , LifeCycle.class
EnumMap
!
:
garden.stream()
.collect(Collectors.groupingBy(
e -> e.getLifeCycle(),
() -> new EnumMap<>(LifeCycle.class),
Collectors.toSet()));
, () ->
, .