Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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

import java.util.List;

import java.util.Set;

public class Main {
    /**
     * @param disorderBoss
     * @return
     */
    public static <T> List<T> set2List(Set<T> set) {
        List<T> ret = newArrayList(set.size());
        for (T t : set) {
            ret.add(t);
        }
        return ret;
    }

    /**
     * Constructs an empty list with the specified initial capacity.
     * 
     * @param <T>
     * @param initialCapacity
     * @return
     */
    public static <T> List<T> newArrayList(int initialCapacity) {
        return new ArrayList<T>(initialCapacity);
    }

    /**
     * Constructs an empty list with an initial capacity of ten.
     * 
     * @param <T>
     * @return
     */
    public static <T> List<T> newArrayList() {
        return newArrayList(10);
    }

    /**
     * @param enemyList
     * @return
     */
    public static <T> List<T> newArrayList(List<T> c) {
        return new ArrayList<T>(c);
    }
}