Here you can find the source of createArrayList(final DataType first, final DataType second)
Parameter | Description |
---|---|
DataType | The data type. |
first | The first value. |
second | The second value. |
public static <DataType> ArrayList<DataType> createArrayList(final DataType first, final DataType second)
//package com.java2s; /*/*from w w w . ja va2s .co m*/ * 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; } }