You can filter a particular itemType using equals
or equalsIgnoreCase
based on what you want
double sum = itemList.stream()
.filter(type->"EQUIPMENT".equals(type.getItemType()))
.mapToDouble(a -> a.getQuantity())
.sum();
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…