Android Array to List Convert newArrayList(E... elements)

Here you can find the source of newArrayList(E... elements)

Description

new Array List

License

Open Source License

Declaration

public static <E> ArrayList<E> newArrayList(E... elements) 

Method Source Code

//package com.java2s;
// Use of this source code is governed by a BSD-style license that can be

import java.util.ArrayList;
import java.util.Collections;

public class Main {
    public static <E> ArrayList<E> newArrayList(E... elements) {
        ArrayList<E> list = new ArrayList<E>(elements.length);
        Collections.addAll(list, elements);
        return list;
    }//from   w w  w  .  j  a  v a2 s. co m

    public static <E> ArrayList<E> newArrayList(Iterable<E> iterable) {
        ArrayList<E> list = new ArrayList<E>();
        for (E element : iterable)
            list.add(element);
        return list;
    }
}

Related

  1. asList(int[] array)
  2. asList(int[] intArray)
  3. asList(long[] longArray)
  4. convertArrayToList(T[] array)
  5. listOf(final T... items)
  6. getList(int[] s, String separator, String quote)
  7. getList(String[] s, String separator, String quote)
  8. getList(String[][] s, String separator, String quote)