Package ghidra.program.model.listing

# Interface CodeUnitIterator

All Superinterfaces:
  `Iterable<CodeUnit>`, `Iterator<CodeUnit>`

All Known Implementing Classes:
  `CodeUnitKeyIterator`, `CommentTypeFilterIterator`, `EmptyCodeUnitIterator`

public interface CodeUnitIterator extends Iterator<CodeUnit>, Iterable<CodeUnit>
Interface to define an iterator over over some set of code units.

See Also:
  - `CollectionUtils.asIterable(T)`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final CodeUnitIterator`
  `EMPTY_ITERATOR`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `hasNext()`
  Return true if there is a next CodeUnit.
  `CodeUnit`
  `next()`
  Get the next CodeUnit or null if no more CodeUnits.

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

  `forEach, iterator, spliterator`

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

  `forEachRemaining, remove`

- ## Field Details

  - ### EMPTY_ITERATOR

    static final CodeUnitIterator EMPTY_ITERATOR

- ## Method Details

  - ### hasNext

    boolean hasNext()
    Return true if there is a next CodeUnit.
    Specified by:
      `hasNext` in interface `Iterator<CodeUnit>`

  - ### next

    CodeUnit next()
    Get the next CodeUnit or null if no more CodeUnits.

    NOTE: This deviates from the standard `Iterator` interface by returning null instead of throwing an exception.

    Specified by:
      `next` in interface `Iterator<CodeUnit>`