|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sf.staccatocommons.collections.iterable.ModifiableIterables
public class ModifiableIterables
A bunch of static methods that extend the Collections
functionality, providing common algorithms for collections and iterables.
These methods will not work with unmodifiable collections, as may modify
input collections state, and thus we highly encourage to use
Iterables instead, when possible
| Constructor Summary | |
|---|---|
ModifiableIterables()
|
|
| Method Summary | ||
|---|---|---|
static
|
addAll(C collection,
Iterable<? extends T> iterable)
Adds all the elements from a given Iterable to a given collection |
|
static
|
move(Iterable<T> iterable,
C collection,
Evaluable<T> predicate)
Removes all elements from the given iterable that evalute to true, and adds them to the given collection |
|
static
|
move(Iterable<T> iterable,
int amountOfElements,
C collection)
Removes at most n elements from the given iterable, and adds it to the output collection |
|
static
|
remove(I iterable,
int amountOfElements)
Removes up to N elements from the given iterable |
|
static
|
removeAll(I iterable,
Evaluable<? super T> predicate)
Removes from the given iterable all the elements that evaluate to true |
|
static
|
removeWhile(I iterable,
Evaluable<? super T> predicate)
Removes elements from the given iterable, while each element evaluates to true |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ModifiableIterables()
| Method Detail |
|---|
@NonNull
public static <T,I extends Iterable<T>> I removeAll(@NonNull
I iterable,
@NonNull
Evaluable<? super T> predicate)
T - I - iterable - predicate -
public static <T,I extends Iterable<T>> I removeWhile(@NonNull
I iterable,
@NonNull
Evaluable<? super T> predicate)
T - iterable - predicate -
@NonNull
public static <I extends Iterable<?>> I remove(@NonNull
I iterable,
@NotNegative
int amountOfElements)
I - iterable - amountOfElements - Non negative
@NonNull
public static <T,C extends Collection<T>> C addAll(@NonNull
C collection,
@NonNull
Iterable<? extends T> iterable)
Iterable to a given collection
T - C - collection - iterable -
@NonNull
public static <T,C extends Collection<T>> C move(@NonNull
Iterable<T> iterable,
@NonNull
C collection,
@NonNull
Evaluable<T> predicate)
T - C - iterable - collection - predicate -
@NonNull
public static <T,C extends Collection<T>> C move(@NonNull
Iterable<T> iterable,
@NotNegative
int amountOfElements,
@NonNull
C collection)
T - C - iterable - amountOfElements - the max amount of elements to select from the iterable. Must be >=
0collection -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||