Java Array to List newList(V... items)

Here you can find the source of newList(V... items)

Description

Returns a new list containing the given items.

License

Open Source License

Parameter

Parameter Description
V a parameter
items a parameter

Declaration

public static <V> List<V> newList(V... items) 

Method Source Code

//package com.java2s;

import java.util.ArrayList;

import java.util.List;

public class Main {
    /**/*from  www  .  ja  v a  2 s  . co  m*/
     * Returns a new list containing the given items.
     * 
     * @param <V>
     * @param items
     * @return
     */
    public static <V> List<V> newList(V... items) {

        List<V> list = new ArrayList<V>();
        for (V item : items) {
            list.add(item);
        }
        return list;
    }
}

Related

  1. newList(T... list)
  2. newList(T... objects)
  3. newList(T... objs)
  4. newList(T... ts)
  5. newList(T... values)
  6. toList(@SuppressWarnings("unchecked") T... ts)
  7. toList(boolean... booleans)
  8. toList(boolean[] array)
  9. toList(boolean[] array)