Listlist = stream.collect(Collectors.toList());
Setset = stream.collect(Collectors.toSet());
Mapmap = stream .collect(Collectors.toMap(item -> item.getKey(), item -> item.getValue()));
int sum = stream.mapToInt(Integer::intValue).sum();
double average = stream.mapToInt(Integer::intValue).average().getAsDouble();In summary, Collectors is a package from the Java library that provides a wide range of methods for collecting stream elements into a collection or a single result. It's located in the java.util.stream package.