Interface Values<T,C extends Collection<T>>

Type Parameters:
T - the value type
C - the collection type
All Superinterfaces:
Iterable<T>, Observable<C>, ObservableValues<T,C>, Observer<C>, Value<C>
All Known Subinterfaces:
ValueList<T>, ValueSet<T>

public interface Values<T,C extends Collection<T>> extends Value<C>, ObservableValues<T,C>

An observable wrapper for one or more values.

See Also:
  • Method Details

    • get

      @NonNull C get()
      Specified by:
      get in interface Observable<T>
      Specified by:
      get in interface ObservableValues<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 interface Observable<T>
      Returns:
      true if this observable can be null
    • set

      boolean set(@Nullable Collection<T> values)
      Sets the values.
      Parameters:
      values - the values to set
      Returns:
      true if this Values instance changed
    • add

      boolean add(@Nullable T value)
      Adds a value to this Values instance.
      Parameters:
      value - the value to add
      Returns:
      true if the value was added
      See Also:
    • addAll

      boolean addAll(T... values)
      Adds the given values to this Values instance.
      Parameters:
      values - the values to add
      Returns:
      true if a value was added
      See Also:
    • addAll

      boolean addAll(Collection<T> values)
      Adds the given values to this Values instance.
      Parameters:
      values - the values to add
      Returns:
      true if a value was added
      See Also:
    • remove

      boolean remove(@Nullable T value)
      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

      boolean removeAll(T... values)
      Removes the given values from this Values instance.
      Parameters:
      values - the values to remove
      Returns:
      true if a value was removed
      See Also:
    • removeAll

      boolean removeAll(Collection<T> values)
      Removes the given values from this Values instance.
      Parameters:
      values - the values to remove
      Returns:
      true if a value was removed
      See Also:
    • value

      Value<T> value()
      Returns a Value instance based on this Values. Setting this value to null clears the values. This value consistently returns the first value from the underlying Values 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 an ObservableValues notified each time this value changes.
      Specified by:
      observable in interface Value<T>
      Returns:
      an ObservableValues for this value