Код: Выделить всё
public class Item {
private String name;
private String code;
private Category category;
//getters and setters omitted for brevity
}
public class SimpleItem {
private String name;
private String code;
//getters and setters omitted for brevity
}
Код: Выделить всё
public class itemMapper {
public Map map(Collection items){
return items.stream()
.map(this::mapToSimpleItem)
.collect(groupingBy(Item::getCategory));
}
private SimpleItem mapToSimpleItem(Item item){
//
}
}
Подробнее здесь: https://stackoverflow.com/questions/660 ... -after-map
Мобильная версия