org.assertj.core.util
Class Lists

java.lang.Object
  extended by org.assertj.core.util.Lists

public final class Lists
extends Object

Utility methods related to java.util.Lists.

Author:
Yvonne Wang, Alex Ruiz, Joel Costigliola

Method Summary
static
<T> List<T>
emptyList()
           
static
<T> ArrayList<T>
newArrayList()
          Creates a mutable ArrayList.
static
<T> ArrayList<T>
newArrayList(Iterable<? extends T> elements)
          Creates a mutable ArrayList containing the given elements.
static
<T> ArrayList<T>
newArrayList(Iterator<? extends T> elements)
          Creates a mutable ArrayList containing the given elements.
static
<T> ArrayList<T>
newArrayList(T... elements)
          Creates a mutable ArrayList containing the given elements.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

newArrayList

public static <T> ArrayList<T> newArrayList(T... elements)
Creates a mutable ArrayList containing the given elements.

Type Parameters:
T - the generic type of the ArrayList to create.
Parameters:
elements - the elements to store in the ArrayList.
Returns:
the created ArrayList, of null if the given array of elements is null.

newArrayList

public static <T> ArrayList<T> newArrayList(Iterable<? extends T> elements)
Creates a mutable ArrayList containing the given elements.

Type Parameters:
T - the generic type of the ArrayList to create.
Parameters:
elements - the elements to store in the ArrayList.
Returns:
the created ArrayList, or null if the given Iterable is null.

newArrayList

public static <T> ArrayList<T> newArrayList(Iterator<? extends T> elements)
Creates a mutable ArrayList containing the given elements.

Type Parameters:
T - the generic type of the ArrayList to create.
Parameters:
elements - the elements to store in the ArrayList.
Returns:
the created ArrayList, or null if the given Iterator is null.

newArrayList

public static <T> ArrayList<T> newArrayList()
Creates a mutable ArrayList.

Type Parameters:
T - the generic type of the ArrayList to create.
Returns:
the created ArrayList, of null if the given array of elements is null.

emptyList

public static <T> List<T> emptyList()
Returns:
an empty, immutable List.


Copyright © 2013–2015 AssertJ. All rights reserved.