Collectors.toSet() and HashSet January 4, 2023 by Tarik If you want a guaranteed HashSet, use Collectors.toCollection(HashSet::new).