List<String> result = map.entrySet()
.stream()
.map(Map.Entry::getValue)
.flatMap(x -> x.stream())
.collect(Collectors.toCollection(ArrayList::new));
The above code will create a ArrayList which is not thread safe. So how can be make it thread safe.
ArrayList
will work fine. Also you don't need a thread-safe collection even if you want to run this stream operation in parallel. – Audun