Is it possible to merge iterators in Java? I have two iterators and I want to combine/merge them so that I could iterate though their elements in one go (in same loop) rathe
You can try ConcatIterator from Cactoos:
Iterator names = new ConcatIterator<>( Arrays.asList("Sarah", "Mary").iterator(), Arrays.asList("Jeff", "Johnny").iterator(), );
Also check ConcatIterable, which concatenates Iterables.
Iterable