Java Array to List toList(V... elements)

Here you can find the source of toList(V... elements)

Description

to List

License

Open Source License

Declaration

@SafeVarargs
    public static <V> List<V> toList(V... elements) 

Method Source Code

//package com.java2s;
// The MIT License (MIT)

import java.util.ArrayList;

import java.util.List;

public class Main {
    @SafeVarargs
    public static <V> List<V> toList(V... elements) {
        return toList(new ArrayList<V>(), elements);
    }//from ww w. j  a  va  2s.  co m

    @SafeVarargs
    public static <V> List<V> toList(List<V> l, V... elements) {
        for (V v : elements) {
            l.add(v);
        }
        return l;
    }
}

Related

  1. toList(T[] array)
  2. toList(T[] array)
  3. toList(T[] array)
  4. toList(T[] array)
  5. toList(U... array)
  6. toList(Value... values)