Use Stream API to get the iterator. This is much shorter code.