Class ListUtility

java.lang.Object
com.peterphi.std.util.ListUtility

public class ListUtility extends Object
  • Constructor Details

    • ListUtility

      public ListUtility()
  • Method Details

    • list

      public static <T> List<T> list(T[] items)
    • list

      public static <T> List<T> list(List<T> items)
    • list

      public static <T> List<T> list(Iterable<T> iterable)
      Converts an Iterable into a List
      Parameters:
      iterable -
      Returns:
    • last

      public static <T> T last(List<T> src)
    • head

      public static <T> T head(Iterable<T> list)
      Returns the first element of an Iterable (or null if the list is empty)
      Parameters:
      list -
      Returns:
    • tail

      public static <T> List<T> tail(List<T> list)
      Returns a sublist containing all the items in the list after the first
      Parameters:
      list -
      Returns:
    • iterate

      public static <T> HybridIterator<T> iterate(Iterator<T> items)
    • iterate

      public static <T> HybridIterator<T> iterate(Enumeration<T> items)