Top Description Constructors Methods
org.assertj.core.util

public final Class Lists

extends Object
Class Inheritance
Static Imports
java.util.stream.Collectors.toCollection

Utility methods related to Lists.
Authors
Yvonne Wang, Alex Ruiz, Joel Costigliola

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static <
the generic type of the List.
T
>
List<T>

Returns:

an empty, immutable List.
emptyList
()

Deprecated use Collections#emptyList() instead.
public static <T> List<T>
list(T... elements)

public static <
the generic type of the ArrayList to create.
T
>
ArrayList<T>

Returns:

the created ArrayList, of null if the given array of elements is null.
newArrayList
(T...
the elements to store in the ArrayList.
elements
)

Creates a mutable ArrayList containing the given elements.

public static <
the generic type of the ArrayList to create.
T
>
ArrayList<T>

Returns:

the created ArrayList, or null if the given Iterable is null.
newArrayList
(Iterable<? extends T>
the elements to store in the ArrayList.
elements
)

Creates a mutable ArrayList containing the given elements.

public static <
the generic type of the ArrayList to create.
T
>
ArrayList<T>

Returns:

the created ArrayList, or null if the given Iterator is null.
newArrayList
(Iterator<? extends T>
the elements to store in the ArrayList.
elements
)

Creates a mutable ArrayList containing the given elements.

public static <
the generic type of the ArrayList to create.
T
>
ArrayList<T>

Returns:

the created ArrayList, of null if the given array of elements is null.
newArrayList
()

Creates a mutable ArrayList.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

Listsback to summary
private Lists()

Method Detail

emptyListback to summary
public static <T> List<T> emptyList()

Deprecated

use Collections#emptyList() instead.

Parameters
<T>
the generic type of the List.
Returns:List<T>

an empty, immutable List.

Annotations
@Deprecated
listback to summary
public static <T> List<T> list(T... elements)
Annotations
@SafeVarargs
newArrayListback to summary
public static <T> ArrayList<T> newArrayList(T... elements)

Creates a mutable ArrayList containing the given elements.

Parameters
<T>
the generic type of the ArrayList to create.
elements:T[]

the elements to store in the ArrayList.

Returns:ArrayList<T>

the created ArrayList, of null if the given array of elements is null.

Annotations
@SafeVarargs
newArrayListback to summary
public static <T> ArrayList<T> newArrayList(Iterable<? extends T> elements)

Creates a mutable ArrayList containing the given elements.

Parameters
<T>
the generic type of the ArrayList to create.
elements:Iterable<? extends T>

the elements to store in the ArrayList.

Returns:ArrayList<T>

the created ArrayList, or null if the given Iterable is null.

newArrayListback to summary
public static <T> ArrayList<T> newArrayList(Iterator<? extends T> elements)

Creates a mutable ArrayList containing the given elements.

Parameters
<T>
the generic type of the ArrayList to create.
elements:Iterator<? extends T>

the elements to store in the ArrayList.

Returns:ArrayList<T>

the created ArrayList, or null if the given Iterator is null.

newArrayListback to summary
public static <T> ArrayList<T> newArrayList()

Creates a mutable ArrayList.

Parameters
<T>
the generic type of the ArrayList to create.
Returns:ArrayList<T>

the created ArrayList, of null if the given array of elements is null.