E - The type of elementC - The type of collection, for chainingV - The type of CollectionValueI - The type of ImmutableCollectionValuepublic interface CollectionValue<E,C extends Collection<E>,V extends CollectionValue<E,C,V,I>,I extends ImmutableCollectionValue<E,C,I,V>> extends Value<C>, Iterable<E>
Value that is backed by a Collection of
elements.| Modifier and Type | Method and Description |
|---|---|
V |
add(E element)
Adds the given
element to this CollectionValue. |
V |
addAll(Iterable<E> elements)
|
I |
asImmutable()
Gets the
ImmutableValue version of this Value such that
all data is duplicated across to the new ImmutableValue. |
boolean |
contains(E element)
Checks if the given
E element is contained within the backed
Collection. |
boolean |
containsAll(Collection<E> iterable)
Checks if all of the given
Iterable elements are contained
within the backed Collection. |
V |
copy()
Makes an independent copy of this
Value with the same initial
data. |
V |
filter(Predicate<? super E> predicate)
Applies a
Predicate to filter the underlying elements in the
backed Collection to create a new CollectionValue
separate from this CollectionValue. |
C |
getAll()
Creates a new
Collection of the proper type C with
all elements copied to the new collection. |
boolean |
isEmpty()
Checks if the backed
Collection is empty. |
V |
remove(E element)
Removes the given
element from the backed Collection. |
V |
removeAll(Iterable<E> elements)
Removes all elements from the
Iterable from the backed
Collection. |
V |
removeAll(Predicate<E> predicate)
Iterates over all existing elements and removes any elements that
Predicate.test(Object) returns true. |
V |
set(C value)
Sets the underlying value to the provided
value. |
int |
size()
Gets the size of the underlying collection of elements.
|
V |
transform(Function<C,C> function)
Attempts to transform the underlying value based on the provided
Function such that the result of Function.apply(Object)
will replace the underlying value. |
exists, get, getDefault, getDirect, getKeyforEach, iterator, spliteratorV set(C value)
Valuevalue.set in interface Value<C extends Collection<E>>value - The value to setValueContainerV transform(Function<C,C> function)
ValueFunction such that the result of Function.apply(Object)
will replace the underlying value.transform in interface Value<C extends Collection<E>>function - The function to apply on the existing valueValueContainerint size()
boolean isEmpty()
Collection is empty.Collection.isEmpty()V add(E element)
element to this CollectionValue.element - The element to addV addAll(Iterable<E> elements)
elements - The elements to addCollection.addAll(Collection)V remove(E element)
element from the backed Collection.element - The element to removeV removeAll(Iterable<E> elements)
Iterable from the backed
Collection.elements - The elements to removeV removeAll(Predicate<E> predicate)
Predicate.test(Object) returns true.predicate - The predicate to remove elementsboolean contains(E element)
E element is contained within the backed
Collection.element - The element to checkboolean containsAll(Collection<E> iterable)
Iterable elements are contained
within the backed Collection.iterable - The iterable elementsV filter(Predicate<? super E> predicate)
Predicate to filter the underlying elements in the
backed Collection to create a new CollectionValue
separate from this CollectionValue. This value is not modified,
nor is the underlying Collection. Elements that return
true from Predicate.test(Object) are kept, and
those that return false are excluded.predicate - The predicate to filterC getAll()
Collection of the proper type C with
all elements copied to the new collection. Any modifications to the new
collection are not reflected to this CollectionValue. Likewise,
no modifications to this CollectionValue are reflected to the
returned Collection.I asImmutable()
ValueImmutableValue version of this Value such that
all data is duplicated across to the new ImmutableValue. Note
that once created, the ImmutableValue is not going to change.asImmutable in interface Value<C extends Collection<E>>ImmutableValue instance