Package ghidra.util

# Class UnionAddressRangeIterator

java.lang.Object
generic.util.AbstractPeekableIterator<AddressRange>
ghidra.util.UnionAddressRangeIterator

All Implemented Interfaces:
  `PeekableIterator<AddressRange>`, `AddressRangeIterator`, `Iterable<AddressRange>`, `Iterator<AddressRange>`

public class UnionAddressRangeIterator extends AbstractPeekableIterator<AddressRange> implements AddressRangeIterator
The iterator implementation backing several methods in `UnionAddressSetView`

- ## Field Summary

  ### Fields inherited from class generic.util.AbstractPeekableIterator

  `next, soughtNext`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `UnionAddressRangeIterator(Collection<Iterator<AddressRange>> iterators, boolean forward)`
  Union into a single range iterator, several range iterators
  `UnionAddressRangeIterator(Iterator<AddressRange> it, boolean forward)`
  Coalesce (by union) ranges from a single iterator

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Iterator<AddressRange>`
  `iterator()`
  `protected AddressRange`
  `seekNext()`
  Find the next element in this iterator, because the client called either `AbstractPeekableIterator.next` or `AbstractPeekableIterator.peek()`.

  ### Methods inherited from class generic.util.AbstractPeekableIterator

  `hasNext, next, peek`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  ### Methods inherited from interface java.lang.Iterable

  `forEach, spliterator`

  ### Methods inherited from interface java.util.Iterator

  `forEachRemaining, hasNext, next, remove`

- ## Constructor Details

  - ### UnionAddressRangeIterator

    public UnionAddressRangeIterator(Iterator<AddressRange> it, boolean forward)
    Coalesce (by union) ranges from a single iterator

    The ranges must be returned in order: in the forward direction, by increasing min address; in the reverse direction, by decreasing max address.

    Parameters:
      `it` - the iterator
      `forward` - true to coalesce in the forward direction, false for reverse

  - ### UnionAddressRangeIterator

    public UnionAddressRangeIterator(Collection<Iterator<AddressRange>> iterators, boolean forward)
    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 `UnionAddressRangeIterator(Iterator, boolean)`

    Parameters:
      `iterators` - the iterators to union
      `forward` - true to union in the forward direction, false for reverse

- ## Method Details

  - ### iterator

    public Iterator<AddressRange> iterator()
    Specified by:
      `iterator` in interface `AddressRangeIterator`
    Specified by:
      `iterator` in interface `Iterable<AddressRange>`

  - ### seekNext

    protected AddressRange seekNext()
    Description copied from class: `AbstractPeekableIterator`
    Find the next element in this iterator, because the client called either `AbstractPeekableIterator.next` or `AbstractPeekableIterator.peek()`.
    Specified by:
      `seekNext` in class `AbstractPeekableIterator<AddressRange>`
    Returns:
      the next element