Quick Answer
Collectors are terminal stream operations that accumulate results. Common: Collectors.toList(), toSet(), toMap(), groupingBy() (group into Map>), partitioningBy() (split into two groups by predicate), joining() (concatenate strings), counting(), summingInt(), averagingInt(). Combine with downstream collectors: groupingBy(key, counting()) counts per group.
Answer
Collectors accumulate stream elements into collections or other results. Examples: toList(), toSet(), groupingBy(), joining(). Useful for aggregation and transformation.
S
SugharaIQ Editorial Team
Verified Answer
This answer has been peer-reviewed by industry experts holding senior engineering roles to ensure technical accuracy and relevance for modern interview standards.