Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
/*
 * File:                CollectionUtil.java
 * Authors:             Justin Basilico
 * Company:             Sandia National Laboratories
 * Project:             Cognitive Foundry
 *
 * Copyright March 25, 2008, Sandia Corporation.
 * Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive
 * license for use of this work by or on behalf of the U.S. Government. Export
 * of this program may require a license from the United States Government.
 * See CopyrightHistory.txt for complete details.
 *
 */

import java.util.ArrayList;

public class Main {
    /**
     * Creates a new ArrayList from the given pair of values.
     *
     * @param <DataType>
     *      The data type.
     * @param   first
     *      The first value.
     * @param   second
     *      The second value.
     * @return
     *      A new array list with the two elements in it.
     */
    public static <DataType> ArrayList<DataType> createArrayList(final DataType first, final DataType second) {
        final ArrayList<DataType> result = new ArrayList<DataType>(2);
        result.add(first);
        result.add(second);
        return result;
    }
}