|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface CollectionF<E>
Extended collection.
Methods like filter(Function1B)
, sort()
or plus(Collection)
are permitted to return this
collection if result of operation is a collection equal to this,
even if this collection is mutable.
Method Summary | ||
---|---|---|
void |
addAll(E... additions)
Varargs version of addAll |
|
Function1V<E> |
addF()
Delegate to Collection.add(Object) |
|
Function1V<E> |
addOp()
Deprecated. |
|
Function1B<E> |
containsF()
Delegate to Collection.contains(Object) |
|
Function1B<E> |
containsP()
Deprecated. |
|
CollectionF<E> |
filter(Function1B<? super E> p)
Return collection with only elements that match predicate. |
|
Tuple2<? extends IterableF<E>,? extends IterableF<E>> |
filter2(Function1B<? super E> p)
Pair of collection, first contains elements matching p, second contains element matching !p |
|
|
flatMap(Function<? super E,? extends Collection<B>> f)
Flat map |
|
|
flatMapO(Function<? super E,Option<B>> f)
Flat map variant that accept mapper that returns Option instead of Collection |
|
|
groupBy(Function<? super E,? extends V> m)
Group elements by applying given function to each element. |
|
IteratorF<E> |
iterator()
Elements as iterator |
|
|
map(Function<? super E,B> mapper)
Map |
|
E |
max()
Max element using Comparator.naturalComparator() . |
|
E |
max(Function2I<? super E,? super E> comparator)
Max element using given comparator. |
|
E |
min()
Min element using Comparator.naturalComparator() . |
|
E |
min(Function2I<? super E,? super E> comparator)
Min element using given comparator. |
|
CollectionF<E> |
plus(Collection<? extends E> elements)
Collection with all elements of this collection and that collection. |
|
CollectionF<E> |
plus(E... additions)
Varargs variant of plus(Collection) . |
|
CollectionF<E> |
plus(Iterator<? extends E> iterator)
Collection with all elements of this collection and that collection. |
|
CollectionF<E> |
plus1(E e)
This collection plus one element. |
|
E |
single()
Single element of collection |
|
Option<E> |
singleO()
|
|
ListF<E> |
sort()
Elements sorted by Comparator.naturalComparator() |
|
ListF<E> |
sort(Function2I<? super E,? super E> comparator)
Elements sorted by given comparator |
|
ListF<E> |
sortBy(Function<? super E,?> f)
|
|
ListF<E> |
sortByDesc(Function<? super E,?> f)
|
|
E[] |
toArray(Class<E> cl)
Copy elements to the new array |
|
boolean[] |
toBooleanArray()
|
|
byte[] |
toByteArray()
Copy all elements of this collection to newly allocated byte array. |
|
char[] |
toCharArray()
|
|
double[] |
toDoubleArray()
|
|
float[] |
toFloatArray()
|
|
int[] |
toIntArray()
|
|
ListF<E> |
toList()
Convert this to list |
|
long[] |
toLongArray()
|
|
|
toMap(Function<? super E,Tuple2<K,V>> t)
Map to list of map entries and construct map |
|
|
toMapMappingToKey(Function<? super E,K> m)
Map to list of map keys and construct map. |
|
|
toMapMappingToValue(Function<? super E,V> m)
Map to list of map values and construct map. |
|
short[] |
toShortArray()
|
|
|
uncheckedCast()
Return this with another type parameter and no type checks. |
|
SetF<E> |
unique()
Return set of elements of this |
|
CollectionF<E> |
unmodifiable()
Return unmodifiable view or unmodifiable copy of this. |
Methods inherited from interface java.util.Collection |
---|
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, remove, removeAll, retainAll, size, toArray, toArray |
Methods inherited from interface ru.yandex.bolts.collection.IterableF |
---|
exists, find, foldLeft, foldRight, forAll, forEach, mkString, mkString, reduceLeft, reduceRight |
Method Detail |
---|
IteratorF<E> iterator()
IterableF
iterator
in interface Collection<E>
iterator
in interface Iterable<E>
iterator
in interface IterableF<E>
CollectionF<E> filter(Function1B<? super E> p)
Tuple2<? extends IterableF<E>,? extends IterableF<E>> filter2(Function1B<? super E> p)
<B> ListF<B> map(Function<? super E,B> mapper)
<B> ListF<B> flatMap(Function<? super E,? extends Collection<B>> f)
<B> ListF<B> flatMapO(Function<? super E,Option<B>> f)
<K,V> MapF<K,V> toMap(Function<? super E,Tuple2<K,V>> t)
<K> MapF<K,E> toMapMappingToKey(Function<? super E,K> m)
<V> MapF<E,V> toMapMappingToValue(Function<? super E,V> m)
Function1B<E> containsP()
Function1B<E> containsF()
Collection.contains(Object)
ListF<E> toList()
SetF<E> unique()
ListF<E> sort()
Comparator.naturalComparator()
ListF<E> sort(Function2I<? super E,? super E> comparator)
ListF<E> sortBy(Function<? super E,?> f)
ListF<E> sortByDesc(Function<? super E,?> f)
<V> MapF<V,ListF<E>> groupBy(Function<? super E,? extends V> m)
Function1V<E> addOp()
Function1V<E> addF()
Collection.add(Object)
CollectionF<E> plus1(E e)
CollectionF<E> plus(Collection<? extends E> elements)
CollectionF<E> plus(Iterator<? extends E> iterator)
CollectionF<E> plus(E... additions)
plus(Collection)
.
void addAll(E... additions)
addAll
Collection.addAll(Collection)
E[] toArray(Class<E> cl)
byte[] toByteArray()
Byte
.
short[] toShortArray()
toByteArray()
int[] toIntArray()
toByteArray()
long[] toLongArray()
toByteArray()
boolean[] toBooleanArray()
toByteArray()
char[] toCharArray()
toByteArray()
float[] toFloatArray()
toByteArray()
double[] toDoubleArray()
toByteArray()
CollectionF<E> unmodifiable()
Collections.unmodifiableCollection(Collection)
E single() throws NoSuchElementException
NoSuchElementException
- if this collection is empty or has more then one element.Option<E> singleO() throws NoSuchElementException
NoSuchElementException
- is collection has more then one element.<F> CollectionF<F> uncheckedCast()
this
with another type parameter and no type checks.
uncheckedCast
in interface IterableF<E>
E min()
Comparator.naturalComparator()
.
E min(Function2I<? super E,? super E> comparator)
E max()
Comparator.naturalComparator()
.
E max(Function2I<? super E,? super E> comparator)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |