Java Array to List newList(int... sizes)

Here you can find the source of newList(int... sizes)

Description

new List

License

LGPL

Declaration

public final static <V> List<V> newList(int... sizes) 

Method Source Code

//package com.java2s;
//License from project: LGPL 

import java.util.ArrayList;

import java.util.List;

public class Main {
    public final static <V> List<V> newList(int... sizes) {
        int size = 0;
        for (int it : sizes)
            size += it;// www .j a va2  s. c  o  m
        return new ArrayList<V>(size);
    }

    public final static <V> List<V> newList(List<V> fromList, int... sizes) {
        int size = fromList.size();
        for (int it : sizes)
            size += it;
        return newList(size);
    }
}

Related

  1. fromArray(T... array)
  2. fromArray(T[] array, Class clazz)
  3. fromArray(T[] objects)
  4. newList(final T... elements)
  5. newList(final T... elements)
  6. newList(T... elements)
  7. newList(T... elements)
  8. newList(T... items)
  9. newList(T... list)