@Override
	public T next() {

		// find the best result
		T lowest = null;
		for (PeekableIterator<T> iterator : iterators) {
			if (!iterator.hasNext()) {
				continue;
			}

			T t = iterator.peek();
			if (lowest == null) {
				lowest = t;
				continue;
			}

			int result = comparator.compare(lowest, t);
			if (result > 0) {
				lowest = t;
			}
		}

		if (lowest == null) {
			throw new AssertException(
				"next() has no more items to give!  Call hasNext() before calling next()");
		}

		// now increment the iterator that gave us the best result
		for (PeekableIterator<T> iterator : iterators) {
			if (!iterator.hasNext()) {
				continue;
			}

			T t = iterator.peek();
			int result = comparator.compare(lowest, t);
			if (result == 0) {
				iterator.next();
				return lowest;
			}
		}

		throw new AssertException(
			"next() has no more items to give!  Call hasNext() before calling next()");
	}
Use this constructor when the items of the iterators are not naturally comparable (i.e., 
they do not implement {@link Comparable}).

@param iterators the iterators that provide the data
@param comparator the comparator used to find the next item
@param forward true if the iterators provide data sorted ascending; false for descending
Ghidra/Framework/Generic/src/main/java/generic/util/MultiIterator.java