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
move your loop to a method and pass the iterator to method.
void methodX(Iterator x) { while (x.hasNext()) { .... } }