Package ghidra.program.model.block

# Interface CodeBlockIterator

All Superinterfaces:
  `Iterable<CodeBlock>`

All Known Implementing Classes:
  `SimpleBlockIterator`, `SingleEntSubIterator`

public interface CodeBlockIterator extends Iterable<CodeBlock>
An iterator interface over CodeBlocks.

Note: this iterator is also `Iterable`. The `hasNext()` and `next()` methods of this interface throw a `CancelledException` if the monitor is cancelled. The iterator returned from `iterator()` does not throw a cancelled exception. If you need to know the cancelled state of this iterator, then you must check the cancelled state of the monitor passed into this iterator via the `CodeBlockModel`. See `TaskMonitor.isCancelled()`.

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

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `hasNext()`
  Return true if next() will return a CodeBlock.
  `default Iterator<CodeBlock>`
  `iterator()`
  `CodeBlock`
  `next()`
  Return the next CodeBlock.

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

  `forEach, spliterator`

- ## Method Details

  - ### hasNext

    boolean hasNext() throws CancelledException
    Return true if next() will return a CodeBlock.
    Returns:
      true if next() will return a CodeBlock.
    Throws:
      `CancelledException` - thrown if the operation is cancelled.

  - ### next

    CodeBlock next() throws CancelledException
    Return the next CodeBlock.
    Returns:
      the next CodeBlock.
    Throws:
      `CancelledException` - thrown if the operation is cancelled.

  - ### iterator

    default Iterator<CodeBlock> iterator()
    Specified by:
      `iterator` in interface `Iterable<CodeBlock>`