@Override
	protected AddressRange seekNext() {
		if (!mit.hasNext()) {
			return null;
		}
		AddressRange peek = mit.peek();
		Address min = peek.getMinAddress();
		Address max = peek.getMaxAddress();
		while (true) {
			mit.next();
			if (!mit.hasNext()) {
				break;
			}
			peek = mit.peek();
			if (peek.getAddressSpace() != min.getAddressSpace()) {
				break;
			}
			if (forward) {
				Address n = max.next();
				if (n != null && peek.getMinAddress().compareTo(n) > 0) {
					break;
				}
				max = cmax(max, peek.getMaxAddress());
			}
			else {
				Address p = min.previous();
				if (p != null && peek.getMaxAddress().compareTo(p) < 0) {
					break;
				}
				min = cmin(min, peek.getMinAddress());
			}
		}
		return new AddressRangeImpl(min, max);
	}
Union into a single range iterator, several range iterators

The ranges will be coalesced so that each returned range is disconnected from any other. The
ranges of each iterator must be returned in order by direction. While not recommended, the
ranges of each iterator may overlap, so long as they are sorted as in
{@link #UnionAddressRangeIterator(Iterator, boolean)}

@param iterators the iterators to union
@param forward true to union in the forward direction, false for reverse
Ghidra/Debug/ProposedUtils/src/main/java/ghidra/util/UnionAddressRangeIterator.java