|
|||||||||
| 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
|
nonNullElements(Collection<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 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> 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> 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> Collection<T> nonNullElements(Collection<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 | ||||||||