Java List from Array array2List(T... array)

Here you can find the source of array2List(T... array)

Description

Convert array to List Example: List stooges = ArrayUtil.array2List("Larry", "Moe", "Curly");

License

Apache License

Parameter

Parameter Description
array a parameter

Declaration

public static <T> List<T> array2List(T... array) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.util.Arrays;
import java.util.List;

public class Main {
    /**/*from w  ww  .j  a  v a  2 s .c om*/
     * Convert array to List
     * 
     * Example:
     *     List<String> stooges = ArrayUtil.array2List("Larry", "Moe", "Curly");
     *     
     * @param array
     * @return
     */
    public static <T> List<T> array2List(T... array) {
        return Arrays.asList(array);
    }
}

Related

  1. array2ArrayList(final T[] array)
  2. array2List(Object[] obj)
  3. array2list(String[] array)
  4. arrayAsArrayList(E... elements)
  5. arrayAsList(Object value)
  6. arrayAsList(Object[] array)
  7. arrayAsListCopy(T... array)