Module is.codion.common.core
Package is.codion.common.value
Interface Values<T,C extends Collection<T>>
- Type Parameters:
T
- the value typeC
- the collection type
- All Superinterfaces:
Iterable<T>
,Observable<C>
,ObservableValues<T,
,C> Observer<C>
,Value<C>
An observable wrapper for one or more values.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
Values.Builder<T,
C extends Collection<T>, B extends Values.Builder<T, C, B>> Builds aValues
instance.Nested classes/interfaces inherited from interface is.codion.common.value.Value
Value.BuilderFactory, Value.Notify, Value.Validator<T>
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Adds a value to this Values instance.boolean
addAll
(Collection<T> values) Adds the given values to this Values instance.boolean
Adds the given values to this Values instance.get()
default boolean
If false then get() is guaranteed to never return null.Returns anObservableValues
notified each time this value changes.boolean
Removes a single instance of the given value from this Values instance.boolean
removeAll
(Collection<T> values) Removes the given values from this Values instance.boolean
Removes the given values from this Values instance.boolean
set
(@Nullable Collection<T> values) Sets the values.value()
Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
Methods inherited from interface is.codion.common.observable.Observable
addConsumer, addListener, addWeakConsumer, addWeakListener, getOrThrow, getOrThrow, isEqualTo, isNotEqualTo, isNull, observer, optional, removeConsumer, removeListener, removeWeakConsumer, removeWeakListener
Methods inherited from interface is.codion.common.value.ObservableValues
contains, containsAll, isEmpty, size
-
Method Details
-
get
- Specified by:
get
in interfaceObservable<T>
- Specified by:
get
in interfaceObservableValues<T,
C extends Collection<T>> - Returns:
- the value
-
isNullable
default boolean isNullable()Description copied from interface:Observable
If false then get() is guaranteed to never return null.- Specified by:
isNullable
in interfaceObservable<T>
- Returns:
- true if this observable can be null
-
set
Sets the values.- Parameters:
values
- the values to set- Returns:
- true if this
Values
instance changed
-
add
Adds a value to this Values instance.- Parameters:
value
- the value to add- Returns:
- true if the value was added
- See Also:
-
addAll
Adds the given values to this Values instance.- Parameters:
values
- the values to add- Returns:
- true if a value was added
- See Also:
-
addAll
Adds the given values to this Values instance.- Parameters:
values
- the values to add- Returns:
- true if a value was added
- See Also:
-
remove
Removes a single instance of the given value from this Values instance.- Parameters:
value
- the value to remove- Returns:
- true if the value was removed
- See Also:
-
removeAll
Removes the given values from this Values instance.- Parameters:
values
- the values to remove- Returns:
- true if a value was removed
- See Also:
-
removeAll
Removes the given values from this Values instance.- Parameters:
values
- the values to remove- Returns:
- true if a value was removed
- See Also:
-
value
Returns aValue
instance based on thisValues
. Setting this value to null clears the values. This value consistently returns the first value from the underlyingValues
in case it is sequenced and contains multiple items.- Returns:
- a single item value based on this values instance
-
observable
ObservableValues<T,C> observable()Returns anObservableValues
notified each time this value changes.- Specified by:
observable
in interfaceValue<T>
- Returns:
- an
ObservableValues
for this value
-