Java List from listOf(Collection coll)

Here you can find the source of listOf(Collection coll)

Description

list Of

License

Open Source License

Declaration

public static <T> List<T> listOf(Collection<T> coll) 

Method Source Code


//package com.java2s;
/*/*from  ww w.  java  2  s  . c o m*/
 *
 *  Managed Data Structures
 *  Copyright ? 2016 Hewlett Packard Enterprise Development Company LP.
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU Lesser General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 *  As an exception, the copyright holders of this Library grant you permission
 *  to (i) compile an Application with the Library, and (ii) distribute the 
 *  Application containing code generated by the Library and added to the 
 *  Application during this compilation process under terms of your choice, 
 *  provided you also meet the terms and conditions of the Application license.
 *
 */

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;

import java.util.List;

public class Main {
    public static <T> List<T> listOf(Collection<T> coll) {
        return new ArrayList<>(coll);
    }

    @SafeVarargs
    public static <T> List<T> listOf(T... ts) {
        return listOf(Arrays.asList(ts));
    }
}

Related

  1. listOf(A... values)
  2. listOf(A[] objs)
  3. listOf(Class type)
  4. listOf(Collection collection, T... elements)
  5. listOf(Collection... elts)
  6. listOf(double... values)
  7. listOf(E... elements)