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

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

public interface Values<T,C extends Collection<T>> extends Value<C>, ValuesObserver<T,C>
An observable wrapper for one or more values, including a possible null value. A factory for Values instances.
See Also:
  • Method Details

    • set

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

      boolean add(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(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
    • observer

      ValuesObserver<T,C> observer()
      Returns a ValuesObserver notified each time this value changes.
      Specified by:
      observer in interface Value<T>
      Returns:
      a ValuesObserver for this value
    • builder

      static <T, C extends Collection<T>> Values.Builder<T,C,?> builder(Supplier<C> create, Function<C,C> unmodifiable)
      Type Parameters:
      T - the value type
      C - the collection type
      Parameters:
      create - creates an empty instance of the required collection type
      unmodifiable - returns an unmodifiable view of the given collection
      Returns:
      a Values.Builder instance