Skip to lesson

Parallel word counter

A word counter is a natural job to split across threads: each file can be counted on its own, and only the final totals need to be shared. One task per file runs on a thread pool, and a ConcurrentHashMap adds the partial counts together safely.

Sign in to continue this lesson

Create an account to read every lesson, practise with the exercises and keep track of your progress.