Class KiwiSets

java.lang.Object
org.kiwiproject.collect.KiwiSets

public final class KiwiSets extends Object
Utility methods for working with Set instances.
  • Method Details

    • isNullOrEmpty

      public static <T> boolean isNullOrEmpty(Set<T> set)
      Checks whether the specified set is null or empty.
      Type Parameters:
      T - the type of items in the set
      Parameters:
      set - the set
      Returns:
      true if set is null or empty; false otherwise
    • isNotNullOrEmpty

      public static <T> boolean isNotNullOrEmpty(Set<T> set)
      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:
      true if set is neither null nor empty; false otherwise
    • hasOneElement

      public static <T> boolean hasOneElement(Set<T> set)
      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:
      true if set is non-null and has exactly one item; false