# Class Lists (2.1.0)

<button class="button button-with-icon cloud-select-dropdown__button " aria-haspopup="true">Version latest</button>

- [2.1.0 (latest)](https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.util.Lists)
- [2.0.3](https://docs.cloud.google.com/java/docs/reference/google-http-client/2.0.3/com.google.api.client.util.Lists)
- [1.47.1](https://docs.cloud.google.com/java/docs/reference/google-http-client/1.47.1/com.google.api.client.util.Lists)
- [1.46.3](https://docs.cloud.google.com/java/docs/reference/google-http-client/1.46.3/com.google.api.client.util.Lists)
- [1.45.3](https://docs.cloud.google.com/java/docs/reference/google-http-client/1.45.3/com.google.api.client.util.Lists)
- [1.44.2](https://docs.cloud.google.com/java/docs/reference/google-http-client/1.44.2/com.google.api.client.util.Lists)
- [1.43.2](https://docs.cloud.google.com/java/docs/reference/google-http-client/1.43.2/com.google.api.client.util.Lists)
- [1.42.3](https://docs.cloud.google.com/java/docs/reference/google-http-client/1.42.3/com.google.api.client.util.Lists)
- [1.41.8](https://docs.cloud.google.com/java/docs/reference/google-http-client/1.41.8/com.google.api.client.util.Lists)

    public final class Lists

Static utility methods pertaining to [List](https://docs.oracle.com/javase/8/docs/api/java/util/List.html) instances.

NOTE: this is a copy of a subset of Guava's com.google.common.collect.Lists. The
implementation must match as closely as possible to Guava's implementation.

## Inheritance

[java.lang.Object](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html) \> Lists

## Inherited Members

[Object.clone()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--) [Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-) [Object.finalize()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--) [Object.getClass()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--) [Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--) [Object.notify()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--) [Object.notifyAll()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--) [Object.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--) [Object.wait()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--) [Object.wait(long)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-) [Object.wait(long,int)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-)

## Static Methods

### \<E\>newArrayList()

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

Returns a new mutable, empty `ArrayList` instance.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/util/ArrayList.html<E>` |   |

### \<E\>newArrayList(Iterable\<? extends E\> elements)

    public static ArrayList<E> <E>newArrayList(Iterable<? extends E> elements)

Returns a new mutable `ArrayList` instance containing the given elements.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `elements` | `https://docs.oracle.com/javase/8/docs/api/java/lang/Iterable.html<? extends E>` the elements that the list should contain, in order |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/util/ArrayList.html<E>` | a new `ArrayList` containing those elements |

### \<E\>newArrayList(Iterator\<? extends E\> elements)

    public static ArrayList<E> <E>newArrayList(Iterator<? extends E> elements)

Returns a new mutable `ArrayList` instance containing the given elements.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `elements` | `https://docs.oracle.com/javase/8/docs/api/java/util/Iterator.html<? extends E>` the elements that the list should contain, in order |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/util/ArrayList.html<E>` | a new `ArrayList` containing those elements |

### \<E\>newArrayListWithCapacity(int initialArraySize)

    public static ArrayList<E> <E>newArrayListWithCapacity(int initialArraySize)

Creates an `ArrayList` instance backed by an array of the *exact* size specified;
equivalent to ArrayList#ArrayList(int).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `initialArraySize` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` the exact size of the initial backing array for the returned array list (`ArrayList` documentation calls this value the "capacity") |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/util/ArrayList.html<E>` | a new, empty `ArrayList` which is guaranteed not to resize itself unless its size reaches `initialArraySize + 1` |