Here you can find the source of arrayToList(T[] source)
Parameter | Description |
---|---|
T | the type of elements of the list |
source | the array |
public static <T> List<T> arrayToList(T[] source)
//package com.java2s; /******************************************************************************* * Copyright (c) 2008, 2010 VMware Inc./*from www . ja va2 s . c om*/ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * VMware Inc. - initial contribution *******************************************************************************/ import java.util.Arrays; import java.util.List; public class Main { /** * Convert the supplied array into a List. * <p>A <code>null</code> source value will be converted to an * empty List. * @param <T> the type of elements of the list * @param source the array * @return the converted List result * @see ObjectUtils#toObjectArray(Object) */ public static <T> List<T> arrayToList(T[] source) { return Arrays.asList(source); } }