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

## Interface IterableSelector<T>

- All Superinterfaces:
    `EventListener`, `Iterable<T>`, `PhaseLifecycleListener`, `Selector`, `SolverLifecycleListener`
  All Known Subinterfaces:
    `EntityIndependentValueSelector`, `EntitySelector`, `ListIterableSelector<T>`, `MoveSelector`, `PillarSelector`, `SubChainSelector`
  All Known Implementing Classes:
    `AbstractCachingEntitySelector`, `AbstractCachingMoveSelector`, `AbstractEntitySelector`, `AbstractMoveSelector`, `CachingEntitySelector`, `CachingMoveSelector`, `CachingValueSelector`, `CartesianProductMoveSelector`, `ChangeMoveSelector`, `CompositeMoveSelector`, `DefaultPillarSelector`, `DefaultSubChainSelector`, `EntityIndependentFilteringValueSelector`, `EntityIndependentInitializedValueSelector`, `FilteringEntitySelector`, `FilteringMoveSelector`, `FromSolutionEntitySelector`, `FromSolutionPropertyValueSelector`, `GenericMoveSelector`, `KOptMoveSelector`, `MimicRecordingEntitySelector`, `MimicRecordingValueSelector`, `MimicReplayingEntitySelector`, `MimicReplayingValueSelector`, `MoveIteratorFactoryToMoveSelectorBridge`, `MoveListFactoryToMoveSelectorBridge`, `NearEntityNearbyEntitySelector`, `PillarChangeMoveSelector`, `PillarSwapMoveSelector`, `ProbabilityEntitySelector`, `ProbabilityMoveSelector`, `ProbabilityValueSelector`, `SelectedCountLimitEntitySelector`, `SelectedCountLimitMoveSelector`, `SelectedCountLimitValueSelector`, `ShufflingEntitySelector`, `ShufflingMoveSelector`, `ShufflingValueSelector`, `SortingEntitySelector`, `SortingMoveSelector`, `SortingValueSelector`, `SubChainChangeMoveSelector`, `SubChainSwapMoveSelector`, `SwapMoveSelector`, `TailChainSwapMoveSelector`, `UnionMoveSelector`

      public interface IterableSelector<T>
      extends Selector, Iterable<T>

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `long` | `getSize()` | A random JIT `Selector` with `Selector.isNeverEnding()` true should return a size as if it would be able to return each distinct element only once, because the size can be used in `SelectionProbabilityWeightFactory`.

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

      `forEach, iterator, spliterator`

    - ### Methods inherited from interface org.optaplanner.core.impl.phase.event.PhaseLifecycleListener

      `phaseEnded, phaseStarted, stepEnded, stepStarted`

    - ### Methods inherited from interface org.optaplanner.core.impl.heuristic.selector.Selector

      `getCacheType, isCountable, isNeverEnding`

    - ### Methods inherited from interface org.optaplanner.core.impl.solver.event.SolverLifecycleListener

      `solvingEnded, solvingStarted`

- - ### Method Detail

    - #### getSize

          long getSize()

      A random JIT `Selector` with `Selector.isNeverEnding()` true should return a size as if it would be able to return each distinct element only once, because the size can be used in `SelectionProbabilityWeightFactory`.
      Returns:
        the approximate number of elements generated by this `Selector`, always `>= 0`
      Throws:
        `IllegalStateException` - if `Selector.isCountable()` returns false, but not if only `Selector.isNeverEnding()` returns true