- Type Parameters:
T- the value type
- All Superinterfaces:
Iterable<T>,Observable<Set<T>>,ObservableValueCollection<T,,Set<T>> Observer<Set<T>>,Value<Set<T>>,ValueCollection<T,Set<T>>
An observable wrapper for an orderered Set of values.
A factory for ValueSet instances.
All implementations are thread-safe and support concurrent access.
This set maintains item ordering and can be sorted via ValueCollection.sort(Comparator),
but note that sorting does not trigger change events, since item
ordering does not factor into Set equality.
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface is.codion.common.reactive.value.Value
Value.BuilderFactory, Value.Notify, Value.Validator<T> -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> ValueSet.Builder<T> builder()Creates a newValueSet.Builderinstance.static <T> ValueSet.Builder<T> builder(Collection<T> values) Creates a newValueSet.Builderinstance.Returns anObservableValueCollectionnotified each time this value changes.static <T> ValueSet<T> valueSet()Creates a new emptyValueSet, usingValue.Notify.CHANGED.static <T> ValueSet<T> valueSet(Collection<T> values) Creates a newValueSet, usingValue.Notify.CHANGED.Methods inherited from interface java.lang.Iterable
forEach, iterator, spliteratorMethods inherited from interface is.codion.common.reactive.observer.Observable
addConsumer, addListener, addWeakConsumer, addWeakListener, getOrThrow, getOrThrow, is, isNot, isNull, observer, removeConsumer, removeListener, removeWeakConsumer, removeWeakListener, when, whenMethods inherited from interface is.codion.common.reactive.value.ObservableValueCollection
contains, containsAll, containsNone, containsOnly, isEmpty, size
-
Method Details
-
observable
ObservableValueSet<T> observable()Description copied from interface:ValueCollectionReturns anObservableValueCollectionnotified each time this value changes.- Specified by:
observablein interfaceValue<T>- Specified by:
observablein interfaceValueCollection<T,Set<T>> - Returns:
- an
ObservableValueCollectionfor this value
-
valueSet
Creates a new emptyValueSet, usingValue.Notify.CHANGED.- Type Parameters:
T- the value type- Returns:
- a new
ValueSet
-
valueSet
Creates a newValueSet, usingValue.Notify.CHANGED.- Type Parameters:
T- the value type- Parameters:
values- the initial values, may not be null- Returns:
- a new
ValueSet - Throws:
NullPointerException- in casevaluesis null
-
builder
Creates a newValueSet.Builderinstance.- Type Parameters:
T- the value set type- Returns:
- a new builder
-
builder
Creates a newValueSet.Builderinstance.- Type Parameters:
T- the value set type- Parameters:
values- the initial values, may not be null- Returns:
- a new builder
- Throws:
NullPointerException- in casevaluesis null
-