Here you can find the source of toList(T[] array)
Parameter | Description |
---|---|
T | the type |
array | the array to convert |
public static <T> List<T> toList(T[] array)
//package com.java2s; import java.util.ArrayList; import java.util.List; public class Main { /**/* ww w .ja v a 2 s . c o m*/ * Converts an array to a {@link List}. * * @param <T> the type * @param array the array to convert * @return the {@link List} */ public static <T> List<T> toList(T[] array) { final List<T> result = new ArrayList<T>(array.length); for (final T element : array) { result.add(element); } return result; } }