Code:
- * Copyright (c) 2009 James R. Perkins Jr. (JRP) - All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * - Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * - Neither the James R. Perkins Jr. nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
- package com.jamezp.util;
-
- import java.util.ArrayList;
- import java.util.Collection;
- import java.util.LinkedList;
- import java.util.Stack;
- import java.util.Vector;
-
- * This is a convenience factory class for various generic <code>List</code>
- * implementations.
- *
- * @author James R. Perkins (JRP)
- *
- */
- public class ListFactory {
-
- * This static factory method will construct a new generic
- * <code>ArrayList</code> instance.
- *
- * @return a new generic <code>ArrayList</code> instance
- * @see java.util.ArrayList
- */
- public static <E> ArrayList<E> newArrayList() {
- return new ArrayList<E>();
- }
-
-
- * This static factory method will construct a new generic
- * <code>ArrayList</code> instance.
- *
- * @param c
- * a <code>Collection</code> to initialize the
- * <code>ArrayList</code> with
- *
- * @return a new generic <code>ArrayList</code> instance
- * @see java.util.ArrayList
- */
- public static <E> ArrayList<E> newArrayList(Collection<? extends E> c) {
- return new ArrayList<E>(c);
- }
-
-
- * This static factory method will construct a new generic
- * <code>ArrayList</code> instance.
- *
- * @param initialCapacity
- * the initial capacity of the <code>ArrayList</code>
- *
- * @return a new generic <code>ArrayList</code> instance
- * @see java.util.ArrayList
- */
- public static <E> ArrayList<E> newArrayList(int initialCapacity) {
- return new ArrayList<E>(initialCapacity);
- }
-
-
- * This static factory method will construct a new generic
- * <code>LinkedList</code> instance.
- *
- * @return a new generic <code>LinkedList</code> instance
- * @see java.util.LinkedList
- */
- public static <E> LinkedList<E> newLinkedList() {
- return new LinkedList<E>();
- }
-
-
- * This static factory method will construct a new generic
- * <code>LinkedList</code> instance.
- *
- * @param c
- * a <code>Collection</code> to initialize the
- * <code>LinkedList</code> with
- *
- * @return a new generic <code>LinkedList</code> instance
- * @see java.util.LinkedList
- */
- public static <E> LinkedList<E> newLinkedList(Collection<? extends E> c) {
- return new LinkedList<E>(c);
- }
-
-
- * This static factory method will construct a new generic
- * <code>Stack</code> instance.
- *
- * @return a new generic <code>Stack</code> instance
- * @see java.util.Stack
- */
- public static <E> Stack<E> newStatck() {
- return new Stack<E>();
- }
-
-
- * This static factory method will construct a new generic
- * <code>Vector</code> instance.
- *
- * @return a new generic <code>Vector</code> instance
- * @see java.util.Vector
- */
- public static <E> Vector<E> newVector() {
- return new Vector<E>();
- }
-
-
- * This static factory method will construct a new generic
- * <code>Vector</code> instance.
- *
- * @param c
- * a <code>Collection</code> to initialize the
- * <code>Vector</code> with
- *
- * @return a new generic <code>Vector</code> instance
- * @see java.util.Vector
- */
- public static <E> Vector<E> newVector(Collection<? extends E> c) {
- return new Vector<E>(c);
- }
-
-
- * This static factory method will construct a new generic
- * <code>Vector</code> instance.
- *
- * @param initialCapacity
- * the initial capacity of the <code>Vector</code>
- *
- * @return a new generic <code>Vector</code> instance
- * @see java.util.Vector
- */
- public static <E> Vector<E> newVectory(int initialCapacity) {
- return new Vector<E>(initialCapacity);
- }
-
-
- * This static factory method will construct a new generic
- * <code>Vector</code> instance.
- *
- * @param initialCapacity
- * the initial capacity of the <code>Vector</code>
- * @param the
- * amount by which the capacity is increased when the vector
- * overflows
- *
- * @return a new generic <code>Vector</code> instance
- * @see java.util.Vector
- */
- public static <E> Vector<E> newVectory(int initialCapacity,
- int capacityIncrement) {
- return new Vector<E>(initialCapacity);
- }
-
- }
-
|
|