filmov
tv
Concurrent vs. Non-Concurrent Map Collectors for Java Sequential and Parallel Streams (part 2)

Показать описание
This video walks through the implementation of ConcurrentMapCollector, which is a generic custom concurrent collector that accumulates input elements of type T into a ConcurrentHashMap parameterized with K and V types and returns a type M that extends Map, which enables the resulting Map to produce the elements in sorted order. The ConcurrentMapCollector is used in an example that creates Java HashMap and TreeMap objects that associate unique words in the complete works of William Shakespeare with the number of times each word appears and prints the top 50 words in Shakespeare's works.