Here you can find the source of newList(T... values)
Parameter | Description |
---|---|
T | The set elements type. |
values | The set elements. |
public static <T> List<T> newList(T... values)
//package com.java2s; /*//from w w w . j ava2s . com * Entwined STM * * (c) Copyright 2013 CERN. This software is distributed under the terms of the Apache License Version 2.0, copied * verbatim in the file "COPYING". In applying this licence, CERN does not waive the privileges and immunities granted * to it by virtue of its status as an Intergovernmental Organization or submit itself to any jurisdiction. */ import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class Main { /** * A fast and easy way to build a list.It delegates to {@link Arrays#asList(Object...)}. * * @param <T> The set elements type. * @param values The set elements. * @return The newly constructed hash set. */ public static <T> List<T> newList(T... values) { if (null == values) { return new ArrayList<T>(); } else { return new ArrayList<T>(Arrays.asList(values)); } } }