|
|||||||||
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
Understands 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(Collection<?> c)
Returns true if the given collection has only null elements, false
otherwise. |
|
static boolean |
isEmpty(Collection<?> c)
Returns true if the given collection is null or empty. |
|
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. |
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> 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(Collection<?> c)
true
if the given collection is null
or empty.
c
- the collection to check.
true
if the given collection is null
or empty, otherwise false
.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(Collection<?> c)
true
if the given collection has only null
elements, false
otherwise. If given collection is empty, this method returns true
.
c
- the given collection. It must not be null.
true
if the given collection has only null
elements or is empty,
false
otherwise.
NullPointerException
- if the given collection is null
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |