Package org.kiwiproject.collect
Class KiwiSets
java.lang.Object
org.kiwiproject.collect.KiwiSets
Utility methods for working with
Set instances.-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> booleanhasOneElement(Set<T> set) Checks whether the specified set is non-null and has only one item.static <T> booleanisNotNullOrEmpty(Set<T> set) Checks whether the specified set is neither null nor empty.static <T> booleanisNullOrEmpty(Set<T> set) Checks whether the specified set is null or empty.
-
Method Details
-
isNullOrEmpty
Checks whether the specified set is null or empty.- Type Parameters:
T- the type of items in the set- Parameters:
set- the set- Returns:
trueif set is null or empty;falseotherwise
-
isNotNullOrEmpty
Checks whether the specified set is neither null nor empty.- Type Parameters:
T- the type of items in the set- Parameters:
set- the set- Returns:
trueif set is neither null nor empty;falseotherwise
-
hasOneElement
Checks whether the specified set is non-null and has only one item.- Type Parameters:
T- the type of items in the set- Parameters:
set- the set- Returns:
trueif set is non-null and has exactly one item;false
-