Java Array to List toList(Value... values)

Here you can find the source of toList(Value... values)

Description

Create a list

License

Open Source License

Parameter

Parameter Description
Value the type of values
values more of the values

Return

the list

Declaration

@SafeVarargs
public static <Value> List<Value> toList(Value... values) 

Method Source Code

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

import java.util.ArrayList;

import java.util.List;

public class Main {
    /**//from w w  w.j a  v  a2 s .c o m
     * Create a list
     *
     * @param <Value> the type of values
     * @param values more of the values
     * @return the list
     */
    @SafeVarargs
    public static <Value> List<Value> toList(Value... values) {
        List<Value> list = new ArrayList<>();

        if (values != null && values.length > 0) {
            for (Value value : values) {
                list.add(value);
            }
        }

        return list;
    }
}

Related

  1. toList(T[] array)
  2. toList(T[] array)
  3. toList(T[] array)
  4. toList(U... array)
  5. toList(V... elements)