Java List from listOf(T... args)

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

Description

list Of

License

Open Source License

Declaration

@SuppressWarnings("unchecked")
    public static <T> ArrayList<T> listOf(T... args) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.util.ArrayList;

public class Main {
    @SuppressWarnings("unchecked")
    public static <T> ArrayList<T> listOf(T... args) {
        ArrayList<T> result = new ArrayList<T>();

        for (T t : args)
            result.add(t);// w  ww.  j  a v a 2s  .co  m

        return result;
    }
}

Related

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