java.lang.Object
org.glassfish.jersey.internal.guava.Lists

public final class Lists extends Object
Static utility methods pertaining to List instances. Also see this class's counterparts Sets, Maps and Queues.

See the Guava User Guide article on Lists.

Since:
2.0 (imported from Google Collections Library)
Author:
Kevin Bourrillion, Mike Bostock, Louis Wasserman
  • Method Details

    • newArrayList

      public static <E> ArrayList<E> newArrayList(Iterable<? extends E> elements)
      Creates a mutable ArrayList instance containing the given elements; a very thin shortcut for creating an empty list then calling Iterables#addAll.

      Note: if mutability is not required and the elements are non-null, use ImmutableList#copyOf(Iterable) instead. (Or, change elements to be a FluentIterable and call elements.toList().)

      Note for Java 7 and later: if elements is a Collection, you don't need this method. Use the ArrayList constructor directly, taking advantage of the new "diamond" syntax.

    • newArrayList

      public static <E> ArrayList<E> newArrayList(Iterator<? extends E> elements)
      Creates a mutable ArrayList instance containing the given elements; a very thin shortcut for creating an empty list and then calling Iterators.addAll(java.util.Collection<T>, java.util.Iterator<? extends T>).

      Note: if mutability is not required and the elements are non-null, use ImmutableList#copyOf(Iterator) instead.