Hello there. There are many ways to iterate over Iterator in Java, but unfortunately Iterator does not have any stream() method. So it looks like you could use this Iterator old school way only.

// Oldfag way #1
while (iter.hasNext()) {
    // This has to be first line
    MyPojo value = iter.next();
    // If it is not you could screw everything up by entering intifinite loop
    // And you definitely will because you are stupid hipster who want to use only streams

    // Do your stuff here

// Oldfag way #2
for (Iterator<MyPojo> iter = whatewer.iterator(); iter.hasNext(); ) {
    // And again this has to be first line
    MyPojo value = iter.next();
    // Some stuff

// Oldfag way #3 (same as while cycle)
for (; iter.hasNext(); ) {
    MyPojo value = iter.next();

But well, as I’ve said before you do not want to accept anything but streams. There is a solution for your problem here. Java 8 has utility classes to help: StreamSupport and Spliterators.

// Every stream based on spliterator but Iterator does not have any.
// We should do next things:
// 1. Create Spliterator from Iterator
// 2. Use StreamSupport to build stream from Spliterator

Stream<MyPojo> myStream = StreamSupport.stream(
    Spliterators.spliteratorUnknownSize(myIterator, Spliterator.ORDERED),
    false // means stream will be sequential (not parallel)

Also I should mention that there is Iterable class. And if you want to convert Iterable into Stream you could do it with less coding because Iterable could return it’s Spliterator.

Stream<MyPojo> myStream = StreamSupport.stream(

This is the one of many examples which proves why you should use Kotlin instead Java. Java standard library developers was lazy enough to add default method in Iterator to produce valid Stream. At the same time Iterable class could produce Spliterator which means you could write less code to convert it into Iterator.

BTW default methods for interfaces and streams were introduced at the same time in Java 8 release.