Java ArrayList Create sizedArrayList(final int size)

Here you can find the source of sizedArrayList(final int size)

Description

Returns a sized array list of type T .

License

Apache License

Parameter

Parameter Description
T Formal type parameter
size Array list size

Return

Array list of type T

Declaration

public static <T> ArrayList<T> sizedArrayList(final int size) 

Method Source Code

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

import java.util.*;

public class Main {
    /**//  w  w  w . j a  v  a  2s .c o m
     * Returns a sized array list of type {@code T}.
     *
     * @param <T> Formal type parameter
     * @param size Array list size
     * @return Array list of type {@code T}
     */
    public static <T> ArrayList<T> sizedArrayList(final int size) {
        return new ArrayList<T>(size);
    }
}

Related

  1. newArrayList(X... args)
  2. newArrayListOnNull(List list)
  3. newArrayListSized(Iterable fromSize)
  4. newArrayListWithCapacity(int initSize)
  5. newArrayOfEmptyArrayList(int len)
  6. sizedArrayList(int capacity)
  7. stringToArrayList(String s, String sep)
  8. stringToArrayList(String string)
  9. toArrayList(int[] intValues)