Package org.assertj.core.util
Class Lists
- java.lang.Object
-
- org.assertj.core.util.Lists
-
public final class Lists extends Object
Utility methods related tojava.util.List
s.- Author:
- Yvonne Wang, Alex Ruiz, Joel Costigliola
-
-
Constructor Summary
Constructors Modifier Constructor Description private
Lists()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> List<T>
emptyList()
static <T> List<T>
list(T... elements)
static <T> ArrayList<T>
newArrayList()
Creates a mutableArrayList
.static <T> ArrayList<T>
newArrayList(Iterable<? extends T> elements)
Creates a mutableArrayList
containing the given elements.static <T> ArrayList<T>
newArrayList(Iterator<? extends T> elements)
Creates a mutableArrayList
containing the given elements.static <T> ArrayList<T>
newArrayList(T... elements)
Creates a mutableArrayList
containing the given elements.
-
-
-
Method Detail
-
newArrayList
@SafeVarargs public static <T> ArrayList<T> newArrayList(T... elements)
Creates a mutableArrayList
containing the given elements.- Type Parameters:
T
- the generic type of theArrayList
to create.- Parameters:
elements
- the elements to store in theArrayList
.- Returns:
- the created
ArrayList
, ofnull
if the given array of elements isnull
.
-
list
@SafeVarargs public static <T> List<T> list(T... elements)
-
newArrayList
public static <T> ArrayList<T> newArrayList(Iterable<? extends T> elements)
Creates a mutableArrayList
containing the given elements.- Type Parameters:
T
- the generic type of theArrayList
to create.- Parameters:
elements
- the elements to store in theArrayList
.- Returns:
- the created
ArrayList
, ornull
if the givenIterable
isnull
.
-
newArrayList
public static <T> ArrayList<T> newArrayList(Iterator<? extends T> elements)
Creates a mutableArrayList
containing the given elements.- Type Parameters:
T
- the generic type of theArrayList
to create.- Parameters:
elements
- the elements to store in theArrayList
.- Returns:
- the created
ArrayList
, ornull
if the givenIterator
isnull
.
-
newArrayList
public static <T> ArrayList<T> newArrayList()
Creates a mutableArrayList
.- Type Parameters:
T
- the generic type of theArrayList
to create.- Returns:
- the created
ArrayList
, ofnull
if the given array of elements isnull
.
-
emptyList
public static <T> List<T> emptyList()
- Type Parameters:
T
- the generic type of theList
.- Returns:
- an empty, immutable
List
.
-
-