Package ghidra.program.util

# Class MultiAddressIterator

java.lang.Object
ghidra.program.util.MultiAddressIterator

public class MultiAddressIterator extends Object
`MultiAddressIterator` is a class for iterating through multiple address iterators simultaneously. The next() method returns the next address as determined from all the iterators.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `MultiAddressIterator(AddressIterator[] iters)`
  Constructor of a multi address iterator for multiple forward address iterators.
  `MultiAddressIterator(AddressIterator[] iters, boolean forward)`
  Constructor of a multi address iterator.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `hasNext()`
  Determines whether or not any of the original iterators has a next address.
  `Address`
  `next()`
  Returns the next address.
  `Address[]`
  `nextAddresses()`
  Returns the next address(es).

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

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

- ## Constructor Details

  - ### MultiAddressIterator

    public MultiAddressIterator(AddressIterator[] iters)
    Constructor of a multi address iterator for multiple forward address iterators.
    Parameters:
      `iters` - the address iterators.

  - ### MultiAddressIterator

    public MultiAddressIterator(AddressIterator[] iters, boolean forward)
    Constructor of a multi address iterator.
    Note: all iterators must iterate in the same direction (forwards or backwards).
    Parameters:
      `iters` - the address iterators. All must iterate in the direction indicated by the "forward" parameter.
      `forward` - true indicates that forward iterators are in the array. false indicates backward iterators are in the array.

- ## Method Details

  - ### hasNext

    public boolean hasNext()
    Determines whether or not any of the original iterators has a next address.
    Returns:
      true if a next address can be obtained from any of the address iterators.

  - ### next

    public Address next()
    Returns the next address. The next address could be from any one of the iterators.
    Returns:
      the next address.

  - ### nextAddresses

    public Address[] nextAddresses()
    Returns the next address(es). The next address could be from any one or more of the iterators.
    Returns:
      an array with the next address(es). Each element in this array corresponds to each iterator passed to the constructor. Null is returned in an element if the next overall address is not the next address from the corresponding iterator.