Thanks @HadiJ for answer
Map<String,Integer> result = Arrays.stream(str)
.reduce(new HashMap<>(), (hashMap, e) -> {
hashMap.merge(e, 1, Integer::sum);
return hashMap;
},
(m, m2) -> {
m.putAll(m2);
return m;
}
);
solved Java stream reduce to map