|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.fest.util.Collections
public final class Collections
Utility methods related to collections.
| Method Summary | ||
|---|---|---|
static
|
duplicatesFrom(Collection<T> c)
Returns any duplicate elements from the given collection. |
|
static
|
filter(Collection<?> target,
CollectionFilter<T> filter)
|
|
static String |
format(Collection<?> c)
Returns the String representation of the given collection, or null if the given collection is null. |
|
static boolean |
hasOnlyNullElements(Iterable<?> iterable)
Returns true if the given Iterable has only null elements, false otherwise. |
|
static boolean |
isEmpty(Iterable<?> iterable)
Returns true if the given Iterable is null or empty. |
|
static
|
list(Iterable<T> iterable)
Creates a list containing the given Iterable elements. |
|
static
|
list(T... elements)
Creates a list containing the given elements. |
|
static
|
list(T element)
Creates a list containing the given element. |
|
static
|
list(T first,
T second)
Creates a list containing the given elements. |
|
static
|
nonNullElements(Iterable<T> c)
Returns a new unmodifiable collection containing the non-null elements of the given collection. |
|
static
|
nonNullElements(List<T> l)
Returns a new unmodifiable list containing the non-null elements of the given list. |
|
static
|
set(T... elements)
Creates a set containing the given elements. |
|
static
|
set(T element)
Creates a set containing the given element. |
|
static
|
set(T first,
T second)
Creates a set containing the given elements. |
|
static int |
sizeOf(Iterable<?> iterable)
Returns the size of the given Iterable. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static <T> List<T> list(T... elements)
T - the type of elements of the list to create.elements - the elements to store in the list.
public static <T> List<T> list(T element)
This method is an alternative to list(Object...) (with one element!) which leads to a spurious
warnings when using a non reifiable type (Note that JDK 7 will provide a way to ignore this warning).
More details here : https://blogs.oracle.com/darcy/entry/projectcoin_inducing_contributory_pollution
T - the type of elements of the list to create.element - the element to store in the list.
public static <T> List<T> list(T first,
T second)
This method is an alternative to list(Object...) (with two elements!) which leads to a spurious
warnings when using a non reifiable type (Note that JDK 7 will provide a way to ignore this warning).
More details here : https://blogs.oracle.com/darcy/entry/projectcoin_inducing_contributory_pollution
T - the type of elements of the list to create.first - the first element to store in the list.second - the second element to store in the list.
public static <T> Set<T> set(T... elements)
T - the type of elements of the set to create.elements - the elements to store in the set.
public static <T> Set<T> set(T element)
This method is an alternative to list(Object...) (with one element!) which leads to a spurious
warnings when using a non reifiable type (Note that JDK 7 will provide a way to ignore this warning).
More details here : https://blogs.oracle.com/darcy/entry/projectcoin_inducing_contributory_pollution
T - the type of elements of the set to create.element - the element to store in the set.
public static <T> Set<T> set(T first,
T second)
This method is an alternative to list(Object...) (with one element!) which leads to a spurious
warnings when using a non reifiable type (Note that JDK 7 will provide a way to ignore this warning).
More details here : https://blogs.oracle.com/darcy/entry/projectcoin_inducing_contributory_pollution
T - the type of elements of the set to create.first - the first element to store in the set.second - the second element to store in the set.
public static <T> Collection<T> duplicatesFrom(Collection<T> c)
T - the generic type of the given collection.c - the given collection that might have duplicate elements.
public static boolean isEmpty(Iterable<?> iterable)
true if the given Iterable is null or empty.
iterable - the Iterable to check.
true if the given Iterable is null or empty, otherwise false.public static int sizeOf(Iterable<?> iterable)
Iterable.
iterable - the Iterable to get size.
Iterable..
IllegalArgumentException - if given Iterable is null.
public static <T> List<T> filter(Collection<?> target,
CollectionFilter<T> filter)
public static String format(Collection<?> c)
String representation of the given collection, or null if the given collection is null.
c - the collection to format.
String representation of the given collection.public static <T> Iterable<T> nonNullElements(Iterable<T> c)
null elements or if it is empty. This method returns
null if the given collection is null.
T - the type of elements of the collection.c - the collection we want to extract non null elements from.
null if the given
collection is null.public static <T> List<T> nonNullElements(List<T> l)
null elements or if it is empty. This method returns null if the given list
is null.
T - the type of elements of the list.l - the list we want to extract non null elements from.
null if the given list is
null.public static boolean hasOnlyNullElements(Iterable<?> iterable)
true if the given Iterable has only null elements, false otherwise. If given
Iterable is empty, this method returns true.
iterable - the given iterable. It must not be null.
true if the given iterable has only null elements or is empty, false otherwise.
NullPointerException - if the given iterable is null.public static <T> List<T> list(Iterable<T> iterable)
Iterable elements.
T - the type of elements of the list to create.iterable - the Iterable to get elements from to store in the list.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||