Class ListUtils

java.lang.Object
dev.prozilla.pine.common.util.ListUtils

public final class ListUtils extends Object
  • Method Details

    • createSingleton

      public static <E> List<E> createSingleton(E element)
    • getInstance

      public static <E, T extends E> T getInstance(List<E> list, Class<T> type)
      Finds the first element in a list of a given type.

      This method is not suitable for frequent usage or usage with large lists.

      Type Parameters:
      E - The type of elements in the list
      T - The type of element to search for
      Parameters:
      list - The list to search in
      type - The type to search for
      Returns:
      The element of the given type, or null if there is none.