Class CollectionUtils
java.lang.Object
com.mapr.org.apache.hadoop.hbase.util.CollectionUtils
Utility methods for dealing with Collections, including treating null collections as empty.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> TgetFirst(Collection<T> collection) first/laststatic <T> Tstatic intgetLastIndex(List<?> list) static <T> booleanisEmpty(Collection<T> collection) emptystatic booleanisLastIndex(List<?> list, int index) static <T> booleannotEmpty(Collection<T> collection) static <T> Collection<T>nullSafe(Collection<T> in) static <A,B> boolean nullSafeSameSize(Collection<A> a, Collection<B> b) static <T> intnullSafeSize(Collection<T> collection) size
-
Constructor Details
-
CollectionUtils
public CollectionUtils()
-
-
Method Details
-
nullSafe
-
nullSafeSize
size -
nullSafeSameSize
-
isEmpty
empty -
notEmpty
-
getFirst
first/last -
getLastIndex
- Parameters:
list- any list- Returns:
- -1 if list is empty, otherwise the max index
-
isLastIndex
- Parameters:
list-index- the index in question- Returns:
- true if it is the last index or if list is empty and -1 is passed for the index param
-
getLast
-