Class CollectionUtil

java.lang.Object
com.github.hypfvieh.util.CollectionUtil

public final class CollectionUtil extends Object
  • Method Details

    • hasValue

      public static boolean hasValue(Collection<?> _coll)
      Verifies if given collection has any value.
      Parameters:
      _coll - collection
      Returns:
      true if given collection is not null and contains any value
    • mutableListOf

      @SafeVarargs public static <T> List<T> mutableListOf(T... _items)
      Creates a mutable List of items.
      Type Parameters:
      T - Type
      Parameters:
      _items - Items to add
      Returns:
      ArrayList
    • getFirstOrDefault

      public static <T> T getFirstOrDefault(Collection<T> _items, T _default)
      Returns the first element in the collection or the default value if collection is null or empty.
      Type Parameters:
      T - type
      Parameters:
      _items - collection with elements
      _default - default if collection is empty/null
      Returns:
      first element of collection or default