Class CollectionUtils
- java.lang.Object
-
- org.fugerit.java.core.lang.helpers.CollectionUtils
-
public class CollectionUtils extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> boolean
addIfNotNull(Collection<T> c, T current)
static <T> boolean
checkSize(Collection<T> c, int size)
Check if a collection is not null and has the given sizestatic <T> boolean
containsOnlyOne(Collection<T> c)
Check if a collection is not null and contains exactly one elementstatic <T> void
fill(Collection<T> c, Iterator<T> it)
static <T> boolean
isEmpty(Collection<T> c)
Check if a collection isnull
or empty.static <T> Collection<T>
merge(Collection<T> merged, Collection<T> toAdd)
-
-
-
Method Detail
-
isEmpty
public static <T> boolean isEmpty(Collection<T> c)
Check if a collection isnull
or empty.- Type Parameters:
T
- the type- Parameters:
c
- the collection- Returns:
true
if the collection is empty or null
-
containsOnlyOne
public static <T> boolean containsOnlyOne(Collection<T> c)
Check if a collection is not null and contains exactly one element- Type Parameters:
T
- the type- Parameters:
c
- the collection- Returns:
true
if the collection is not null and contains only one element
-
checkSize
public static <T> boolean checkSize(Collection<T> c, int size)
Check if a collection is not null and has the given size- Type Parameters:
T
- the type- Parameters:
c
- the collectionsize
- size to check- Returns:
true
if the collection is not null and contains only one element
-
addIfNotNull
public static <T> boolean addIfNotNull(Collection<T> c, T current)
-
merge
public static <T> Collection<T> merge(Collection<T> merged, Collection<T> toAdd)
-
fill
public static <T> void fill(Collection<T> c, Iterator<T> it)
-
-