CycleButtonState

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

Parameters

values

nonempty unique option order.

initialValue

initially selected member of 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 on the creating thread, and propagates its exceptions unchanged when invoked.

Parameters

values

nonempty unique option order.

initialValue

initially selected member of values.

toString

synchronous display conversion used by format.

Throws

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


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

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

Parameters

values

nonempty unique option order formatted through Any.toString.

Throws

when values is empty or contains equal members.