Here you can find the source of listOf(T... elements)
public static <T> List<T> listOf(T... elements)
//package com.java2s; //License from project: Apache License import java.util.ArrayList; import java.util.List; public class Main { public static <T> List<T> listOf(T... elements) { List<T> list = new ArrayList<>(); for (T element : elements) { list.add(element);// w w w .j a va2 s . c o m } return list; } }