Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.util.*;

public class Main {
    /**
     * Creates a new {@link ArrayList} with the inferred type
     * and size, using the given value for each element.
     */
    public static <T> ArrayList<T> alistInit(T value, int size) {
        ArrayList<T> ret = new ArrayList<T>(size);
        for (int i = 0; i < size; i++)
            ret.add(value);
        return ret;
    }
}