Start here. This is the direct spoken answer to practice first.
Overview
A duplicate key is a domain decision, not just an exception to silence with an arbitrary merge function.
The simplest Collectors.toMap(keyMapper, valueMapper) expects unique keys and throws when two elements produce the same key. If duplicates are valid, supply a merge function that defines which value wins or how values combine. If every value must be retained, groupingBy to a list may represent the data more honestly. The right choice depends on what duplicate keys mean in the domain.