@SafeVarargs @SuppressWarnings({"varargs"})
public static <E> List<E> of (E… elements)

Returns an unmodifiable list containing an arbitrary number of elements. See Unmodifiable Lists for details.

Parameters:
<E>    the List's element type
elements    the elements to be contained in the list

Returns:  a List containing the specified elements

Exceptions:
NullPointerException    if an element is null or if the array is null

Since:  9

@apiNote This method also accepts a single array as an argument. The element type of the resulting list will be the component type of the array, and the size of the list will be equal to the length of the array. To create a list with a single element that is an array, do the following:


     String[] array = ... ;
     List<String[]> list = List.<String[]>of(array);
 
This will cause the List.of(E) method to be invoked instead.