Java List from listOf(T... elements)

Here you can find the source of listOf(T... elements)

Description

list Of

License

Apache License

Declaration

public static <T> List<T> listOf(T... elements) 

Method Source Code


//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;
    }
}

Related

  1. listOf(E... elements)
  2. listOf(Iterable it)
  3. listOf(String type)
  4. listOf(T value, int size)
  5. listOf(T... args)
  6. listOf(T... elems)
  7. listOf(T... values)
  8. listOfArrays(T[]... values)
  9. listOfExceptionsAsString(List exs)