Package org.optaplanner.core.impl.heuristic.selector.common.iterator

## Class UpcomingSelectionIterator<S>

- java.lang.Object
- - org.optaplanner.core.impl.heuristic.selector.common.iterator.SelectionIterator<S>
  - - org.optaplanner.core.impl.heuristic.selector.common.iterator.UpcomingSelectionIterator<S>

- Type Parameters:
    `S` - Selection type, for example a `Move` class, an entity class or a value class.
  All Implemented Interfaces:
    `Iterator<S>`
  Direct Known Subclasses:
    `AbstractOriginalChangeIterator`, `AbstractOriginalSwapIterator`, `AbstractRandomChangeIterator`, `AbstractRandomSwapIterator`, `CartesianProductMoveSelector.OriginalCartesianProductMoveIterator`, `FilteringEntitySelector.JustInTimeFilteringEntityIterator`, `FilteringValueSelector.JustInTimeFilteringValueIterator`, `InitializedValueSelector.JustInTimeInitializedValueIterator`

      public abstract class UpcomingSelectionIterator<S>
      extends SelectionIterator<S>

  IMPORTANT: The constructor of any subclass of this abstract class, should never call any of its child `Selector`'s `Iterator.hasNext()` or `Iterator.next()` methods, because that can cause descendant `Selector`s to be selected too early (which breaks `MimicReplayingEntitySelector`).

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `protected boolean` | `hasUpcomingSelection` |
    `protected boolean` | `upcomingCreated` |
    `protected S` | `upcomingSelection` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `UpcomingSelectionIterator()` |

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `protected abstract S` | `createUpcomingSelection()` |
    `boolean` | `hasNext()` |
    `S` | `next()` |
    `protected S` | `noUpcomingSelection()` |
    `String` | `toString()` |

    - ### Methods inherited from class org.optaplanner.core.impl.heuristic.selector.common.iterator.SelectionIterator

      `remove`

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

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

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

      `forEachRemaining`

- - ### Field Detail

    - #### upcomingCreated

          protected boolean upcomingCreated

    - #### hasUpcomingSelection

          protected boolean hasUpcomingSelection

    - #### upcomingSelection

          protected S upcomingSelection

  - ### Constructor Detail

    - #### UpcomingSelectionIterator

          public UpcomingSelectionIterator()

  - ### Method Detail

    - #### hasNext

          public boolean hasNext()

    - #### next

          public S next()

    - #### createUpcomingSelection

          protected abstract S createUpcomingSelection()

    - #### noUpcomingSelection

          protected S noUpcomingSelection()

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`