|
|||||||||
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<?> collection)
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 Collection<Object> |
nonNullElements(Collection<?> collection)
Returns a new collection composed of the non null elements of the given collection. |
|
static List<Object> |
nonNullElements(List<?> list)
Returns a new list composed of 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 Collection<Object> nonNullElements(Collection<?> collection)
Returns an empty collection if given collection has only null elements, and null if given collection is null.
collection
- Collection we want to extract non null elements
public static List<Object> nonNullElements(List<?> list)
Returns an empty list if given list has only null elements, and null if given list is null.
list
- List we want to extract non null elements
public static boolean hasOnlyNullElements(Collection<?> collection)
If given collection is empty, returns true.
collection
- the given collection, must not be null.
NullPointerException
- if the given collection is null
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |