CycleButtonState

constructor(values: List<T>, initialValue: T)(source)

Parameters

values

nonempty unique option order.

initialValue

initially selected member of CycleButtonState.values.

Type Parameters

T

immutable option type.


constructor(values: Collection<T>, initialValue: T, toString: (T) -> String)(source)

Creates state from one caller-owned collection snapshot and explicit display conversion.

Collection iteration order defines cycling order. The collection is copied before validation and is not retained. The conversion is retained for the state lifetime, runs only under the creating execution owner, and propagates its exceptions unchanged when invoked.

Parameters

values

nonempty unique option order.

initialValue

initially selected member of CycleButtonState.values.

toString

synchronous display conversion used by CycleButtonState.format.

Throws

when CycleButtonState.values is empty or contains equal members, or when initialValue is outside CycleButtonState.values.


constructor(values: List<T>)(source)

Creates state selecting the first member of a validated nonempty CycleButtonState.values list.

Parameters

values

nonempty unique option order formatted through Any.toString.

Throws

when CycleButtonState.values is empty or contains equal members.