T - element typepublic interface ZCollection<T>
extends java.lang.Iterable<T>
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(T value)
Adds an element to the collection.
|
default boolean |
addAll(java.lang.Iterable<? extends T> c)
Adds all the objects from the given collection to this collection.
|
void |
clear()
Removes all elements from this collection.
|
boolean |
contains(T value)
Checks if the collection contains the given element.
|
default boolean |
containsAll(java.lang.Iterable<? extends T> c)
Checks if this collection contains all the elements of the given
collection.
|
default ZCollection<T> |
filter(Predicate<T> predicate)
Returns a copy of this collection, containing all values that match
the given filter.
|
java.lang.Class<T> |
getElementClass()
Returns the collection's element class.
|
default boolean |
isEmpty()
Checks if this collection is empty.
|
default <U> ZCollection<U> |
map(java.lang.Class<U> type,
Function<T,U> converter)
Returns a copy of this collection, containing all original values
converted with the given function.
|
default <U> ZCollection<U> |
mapLive(java.lang.Class<U> type,
Function<T,U> converter)
Returns a live (unidirectionally updated) collection of values.
|
default <U> ZCollection<U> |
mapLive(java.lang.Class<U> type,
Function<T,U> converter,
Function<U,T> backwardsConverter)
Returns a live (bidirectionally updated) collection of values.
|
default <U> U |
reduce(BiFunction<U,T,U> reductor,
U initialValue)
Performs a reduce operation on this collection, that is, it updates the
initial value repeatedly with the reduction function to return a single
value.
|
boolean |
remove(T value)
Removes an element from the collection.
|
default boolean |
removeAll(java.lang.Iterable<? extends T> c)
Removes all the objects from the given collection from this collection.
|
int |
size()
Returns the size of this collection.
|
default T[] |
toArray()
Converts this collection to an array.
|
java.lang.Class<T> getElementClass()
boolean add(T value)
value - value to be addedboolean remove(T value)
value - value to be removedboolean contains(T value)
value - value to check the collection fordefault boolean addAll(java.lang.Iterable<? extends T> c)
c - collection of elements to adddefault boolean removeAll(java.lang.Iterable<? extends T> c)
c - collection of elements to removedefault boolean containsAll(java.lang.Iterable<? extends T> c)
c - collection to check forint size()
void clear()
default boolean isEmpty()
default T[] toArray()
default <U> ZCollection<U> mapLive(java.lang.Class<U> type, Function<T,U> converter)
U - resulting element typetype - element classconverter - converter to usedefault <U> ZCollection<U> mapLive(java.lang.Class<U> type, Function<T,U> converter, Function<U,T> backwardsConverter)
U - resulting element typetype - element classconverter - convertor from original to new typebackwardsConverter - convertor from new to original typedefault <U> ZCollection<U> map(java.lang.Class<U> type, Function<T,U> converter)
U - resulting element typetype - element classconverter - conversion functiondefault ZCollection<T> filter(Predicate<T> predicate)
predicate - predicate to usedefault <U> U reduce(BiFunction<U,T,U> reductor, U initialValue)
U - result typereductor - reduction functioninitialValue - initial value