tag:blogger.com,1999:blog-7409597408023081712.post9073159584718845872..comments2024-03-07T06:50:03.725+01:00Comments on Random Thoughts on Java Programming: Turning a Stream into an IterableTurbohttp://www.blogger.com/profile/05959847299811800007noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-7409597408023081712.post-6147937455299557702018-02-22T09:44:20.483+01:002018-02-22T09:44:20.483+01:00Damn. I did not consider this. Good point!Damn. I did not consider this. Good point!Turbohttps://www.blogger.com/profile/05959847299811800007noreply@blogger.comtag:blogger.com,1999:blog-7409597408023081712.post-88529113777118537102018-02-17T21:07:39.389+01:002018-02-17T21:07:39.389+01:00I believe your preferred solution has one big disa...I believe your preferred solution has one big disadvantage, it collects all the elements of the stream in memory. E.g. if the stream is reading the elements from a database (like the JPA 2.2 getResultStream() method), your solution will load all results in memory, put them in a list and evaluate them.<br /><br />The first solution may not do this (that depends on the implementation of the evaluate).SHnoreply@blogger.com