Java ArrayList Create newArrayList(Collection c)

Here you can find the source of newArrayList(Collection c)

Description

Creates a new ArrayList containing the elements of the specified collection, in order.

License

Open Source License

Declaration

public static final <K> ArrayList<K> newArrayList(Collection<? extends K> c) 

Method Source Code

//package com.java2s;

import java.util.ArrayList;

import java.util.Collection;

public class Main {
    /**//from w  w  w. j a  v a2 s.  com
     * Creates a new {@link ArrayList} by examining the expected return type.
     */
    public static final <K> ArrayList<K> newArrayList() {
        return new ArrayList<K>();
    }

    /**
     * Creates a new {@link ArrayList} containing the elements of the specified
     * collection, in order.
     * 
     * @see {@link ArrayList#ArrayList(Collection)}.
     */
    public static final <K> ArrayList<K> newArrayList(Collection<? extends K> c) {
        return new ArrayList<K>(c);
    }
}

Related

  1. newArrayList()
  2. newArrayList()
  3. newArrayList()
  4. newArrayList()
  5. newArrayList(A... elements)
  6. newArrayList(Collection collection)
  7. newArrayList(E... elements)
  8. newArrayList(E... elements)
  9. newArrayList(final Collection elements)