Package org.fest.util
Class Collections
java.lang.Object
org.fest.util.Collections
Utility methods related to
Collections.- Author:
- Yvonne Wang, Alex Ruiz, Joel Costigliola
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Collection<T>duplicatesFrom(Collection<T> c) Returns any duplicate elements from the givenCollection.static Stringformat(Collection<?> c) Returns theStringrepresentation of the givenCollection, ornullif the givenCollectionisnull.static booleanisNullOrEmpty(Collection<?> c) Indicates whether the givenCollectionisnullor empty.static <T> List<T>nonNullElementsIn(Collection<T> c) Returns all the non-nullelements in the givenCollection.
-
Method Details
-
duplicatesFrom
Returns any duplicate elements from the givenCollection.- Type Parameters:
T- the generic type of the givenCollection.- Parameters:
c- the givenCollectionthat might have duplicate elements.- Returns:
- a
Collectioncontaining the duplicate elements of the given one. If no duplicates are found, an emptyCollectionis returned.
-
isNullOrEmpty
Indicates whether the givenCollectionisnullor empty.- Parameters:
c- the givenCollection.- Returns:
trueif the givenCollectionisnullor empty, otherwisefalse.
-
format
Returns theStringrepresentation of the givenCollection, ornullif the givenCollectionisnull.- Parameters:
c- theCollectionto format.- Returns:
- the
Stringrepresentation of the givenCollection.
-
nonNullElementsIn
Returns all the non-nullelements in the givenCollection.- Type Parameters:
T- the type of elements of theCollection.- Parameters:
c- the givenCollection.- Returns:
- all the non-
nullelements in the givenCollection. An empty list is returned if the givenCollectionisnull. - Since:
- 1.1.3
-