Publicado por Unknown en 2:01 p. m.

Sometimes during my work, I need to integrate with other libraries which they return an Iterator object instead of a list. This is fine from the point of view of libraries but it might be a problem when you want to use Java 8 streams on the returned iterator. There is one way to transform the Iterator to Iterable and then easily to stream.





Since all the time I need to remember how to do it, I decided to share the snippet here.







