Java Array to List arrayToList(T[] t)

Here you can find the source of arrayToList(T[] t)

Description

array To List

License

Apache License

Declaration

public static <T> List<T> arrayToList(T[] t) 

Method Source Code


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

import java.util.*;

public class Main {
    public static <T> List<T> arrayToList(T[] t) {
        if (t == null || t.length == 0) {
            return new ArrayList<T>(0);
        }// ww w  .j a  v a2 s.  c o m
        List<T> list = new ArrayList<T>(t.length);
        Collections.addAll(list, t);
        return list;
    }
}

Related

  1. arrayToList(Object[] objs)
  2. arrayToList(String... stringArray)
  3. arrayToList(String[] array, String delim)
  4. arrayToList(String[] str)
  5. arrayToList(T[] array)
  6. fromArray(E[] array)
  7. fromArray(final Object[][] array)
  8. fromArray(Object array[])
  9. fromArray(Object[] array)