E
- type of elements stored in the listpublic interface ICollection<E>
extends java.util.Collection<E>
List
,
Deque
,
ArrayList
,
LinkedList
Modifier and Type | Method and Description |
---|---|
default boolean |
containsIf(java.util.function.Predicate<? super E> predicate)
Determines whether the list contains a matching element.
|
ICollection<E> |
copy()
Returns a copy of this collection with all its elements.
|
default int |
countIf(java.util.function.Predicate<? super E> predicate)
Counts how many elements in the list match the predicate.
|
ICollection<E> |
crop()
Returns an empty copy of this collection.
|
ICollection<E> |
filter(java.util.function.Predicate<? super E> predicate)
Create a new collection by applying the specified filter to all elements.
|
<R> IList<R> |
filterMap(java.util.function.Predicate<E> filter,
java.util.function.Function<E,R> func)
Create a new list by applying the specified filter first and then the mapping function to all elements selected.
|
<R,C extends java.util.Collection<R>> |
flatMap(java.util.function.Function<E,C> func)
Create a new list by applying the specified mapping function to all elements.
|
default E |
getFirst()
Returns the first element stored in the collection.
|
default E |
getFirstOrNull()
Returns the first element stored in the collection.
|
default E |
getIf(java.util.function.Predicate<? super E> predicate)
Returns the first element stored in the collection which matches the predicate.
|
default E |
getSingle()
Returns the only element stored in the collection.
|
default E |
getSingleOrNull()
Returns the only element stored in the collection or null if the collection is empty.
|
<R> IList<R> |
map(java.util.function.Function<E,R> func)
Create a new list by applying the specified mapping function to all elements.
|
<R> IList<R> |
mapFilter(java.util.function.Function<E,R> func,
java.util.function.Predicate<R> filter)
Create a new list by applying the specified mapping function to all elements and then filtering it.
|
default E getFirst()
NoSuchElementException
is thrown.default E getFirstOrNull()
default E getSingle()
NoSuchElementException
is thrown.default E getSingleOrNull()
NoSuchElementException
is thrown.default E getIf(java.util.function.Predicate<? super E> predicate)
default boolean containsIf(java.util.function.Predicate<? super E> predicate)
predicate
- predicate used to search elementdefault int countIf(java.util.function.Predicate<? super E> predicate)
predicate
- a predicate which returns true
for elements to be countedICollection<E> filter(java.util.function.Predicate<? super E> predicate)
predicate
- filter predicate<R> IList<R> map(java.util.function.Function<E,R> func)
IList
, typically GapList
unless the original type is BigList
.func
- mapping function<R,C extends java.util.Collection<R>> IList<R> flatMap(java.util.function.Function<E,C> func)
IList
, typically GapList
unless the original type is BigList
.func
- mapping function<R> IList<R> mapFilter(java.util.function.Function<E,R> func, java.util.function.Predicate<R> filter)
IList
, typically GapList
unless the original type is BigList
.func
- mapping functionfilter
- filter predicate<R> IList<R> filterMap(java.util.function.Predicate<E> filter, java.util.function.Function<E,R> func)
IList
, typically GapList
unless the original type is BigList
.filter
- filter predicatefunc
- mapping functionICollection<E> copy()
ICollection<E> crop()