# Print output for @column tags ?> Lists - Android SDK | Android Developers

Most visited

Recently visited

Lists

public class Lists
extends Object

java.lang.Object
   ↳ com.google.android.collect.Lists


Provides static methods for creating List instances easily, and other utility methods for working with lists.

Summary

Public constructors

Lists()

Public methods

static <E> ArrayList<E> newArrayList(E... elements)

Creates a resizable ArrayList instance containing the given elements.

static <E> ArrayList<E> newArrayList()

Creates an empty ArrayList instance.

Inherited methods

Public constructors

Lists

public Lists ()

Public methods

newArrayList

public static ArrayList<E> newArrayList (E... elements)

Creates a resizable ArrayList instance containing the given elements.

Note: due to a bug in javac 1.5.0_06, we cannot support the following:

List<Base> list = Lists.newArrayList(sub1, sub2);

where sub1 and sub2 are references to subtypes of Base, not of Base itself. To get around this, you must use:

List<Base> list = Lists.<Base>newArrayList(sub1, sub2);

Parameters
elements E: the elements that the list should contain, in order

Returns
ArrayList<E> a newly-created ArrayList containing those elements

newArrayList

public static ArrayList<E> newArrayList ()

Creates an empty ArrayList instance.

Note: if you only need an immutable empty List, use Collections#emptyList instead.

Returns
ArrayList<E> a newly-created, initially-empty ArrayList