Effective Java! Prefer Collection To Stream as a Return Type

Kyle Carter
Jun 12 · 2 min read
Photo by Emile Perron on Unsplash

Often when writing methods we will find ourselves returning a group of items. This may be getting generated at run time, returned from a persistence store, or some other method. With our new found tools of streams we may look to return a Stream object as well from these methods. This sometimes can make a lot of sense but at others is not the correct choice. That is what this chapter is…