Class CollectionsUtil

java.lang.Object
nl.pim16aap2.animatedarchitecture.core.util.CollectionsUtil

public final class CollectionsUtil extends Object
Utility class for collections.
  • Method Details

    • searchIterable

      public static <T> Optional<T> searchIterable(Iterable<T> iterable, Predicate<T> searchPredicate)
      Searches through an Iterable object using a provided search function.
      Type Parameters:
      T - The type of objects stored in the Iterable.
      Parameters:
      iterable - The Iterable object to search through.
      searchPredicate - The search predicate to use.
      Returns:
      The value in the Iterable object for which the search function returns true, otherwise Optional.empty().
    • concat

      public static <T> T[] concat(T[] first, T[] second)
      Concatenate two arrays into a single array.
      Type Parameters:
      T - The type of the arrays.
      Parameters:
      first - First array.
      second - Second array.
      Returns:
      A single concatenated array.
    • concat

      public static <T> List<T> concat(List<T> listA, List<T> listB)
      Concatenates two lists into a single list.
      Type Parameters:
      T - The type of data in the lists.
      Parameters:
      listA - The first list.
      listB - The second list.
      Returns:
      A single list containing all elements from both input lists.