Answer the question
In order to leave comments, you need to log in
How to merge 2 TreeMap using Stream API (Java 8)?
Hello. Question about Stream API
there are 2 TreeMap
TreeMap<String, String> bar = ...
TreeMap<String, String> foo = ...
Answer the question
In order to leave comments, you need to log in
And, in fact, why are streams here? Map::putAll did not please?
Of course not. Mar is a container of key-value pairs. The key to that and the key is that it is unique.
Map<String, String> myMap = Stream.of(bar, foo)
.map(Map::entrySet)
.flatMap(Collection::stream)
//тут дальше группировка
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question