Add convenience collect methods to the Stream interface

Rob Griffin (rgriffin) Rob.Griffin at
Sun Dec 9 22:44:29 UTC 2018


I have raised an enhancement request (Incident Report 913453) about adding some convenience methods to the Stream interface that collect the stream and Pallavi Sonal asked me to start a thread here about that.

More than 50% of our Stream collect calls use Collectors.toList() or Collectors.toSet() as arguments so I think it would be very handy if the Stream interface had default collectToList and collectToList and collectToMap methods. 

The advantages are:
	it would be easier to use code completion in IDEs. There are lot of classes starting with Collect so finding the Collectors class is a bit of a pain.
	one less method call in what is usually a long chain of calls. 


Rob Griffin
Software Analyst, Spotlight on SQL Server
Quest | R&D
rob.griffin at 

More information about the core-libs-dev mailing list