Class Lists


  • public final class Lists
    extends java.lang.Object
    Utility methods related to java.util.Lists.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private Lists()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T> java.util.List<T> emptyList()  
      static <T> java.util.ArrayList<T> newArrayList()
      Creates a mutable ArrayList.
      static <T> java.util.ArrayList<T> newArrayList​(java.lang.Iterable<? extends T> elements)
      Creates a mutable ArrayList containing the given elements.
      static <T> java.util.ArrayList<T> newArrayList​(java.util.Iterator<? extends T> elements)
      Creates a mutable ArrayList containing the given elements.
      static <T> java.util.ArrayList<T> newArrayList​(T... elements)
      Creates a mutable ArrayList containing the given elements.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Lists

        private Lists()
    • Method Detail

      • newArrayList

        @SafeVarargs
        public static <T> java.util.ArrayList<T> newArrayList​(T... elements)
        Creates a mutable ArrayList containing the given elements.
        Type Parameters:
        T - the generic type of the ArrayList to create.
        Parameters:
        elements - the elements to store in the ArrayList.
        Returns:
        the created ArrayList, of null if the given array of elements is null.
      • newArrayList

        public static <T> java.util.ArrayList<T> newArrayList​(java.lang.Iterable<? extends T> elements)
        Creates a mutable ArrayList containing the given elements.
        Type Parameters:
        T - the generic type of the ArrayList to create.
        Parameters:
        elements - the elements to store in the ArrayList.
        Returns:
        the created ArrayList, or null if the given Iterable is null.
      • newArrayList

        public static <T> java.util.ArrayList<T> newArrayList​(java.util.Iterator<? extends T> elements)
        Creates a mutable ArrayList containing the given elements.
        Type Parameters:
        T - the generic type of the ArrayList to create.
        Parameters:
        elements - the elements to store in the ArrayList.
        Returns:
        the created ArrayList, or null if the given Iterator is null.
      • newArrayList

        public static <T> java.util.ArrayList<T> newArrayList()
        Creates a mutable ArrayList.
        Type Parameters:
        T - the generic type of the ArrayList to create.
        Returns:
        the created ArrayList, of null if the given array of elements is null.
      • emptyList

        public static <T> java.util.List<T> emptyList()
        Returns:
        an empty, immutable List.