001 /******************************************************************************* 002 * Portions created by Sebastian Thomschke are copyright (c) 2005-2011 Sebastian 003 * Thomschke. 004 * 005 * All Rights Reserved. This program and the accompanying materials 006 * are made available under the terms of the Eclipse Public License v1.0 007 * which accompanies this distribution, and is available at 008 * http://www.eclipse.org/legal/epl-v10.html 009 * 010 * Contributors: 011 * Sebastian Thomschke - initial implementation. 012 *******************************************************************************/ 013 package net.sf.oval.collection; 014 015 import java.util.List; 016 import java.util.Map; 017 import java.util.Set; 018 019 /** 020 * @author Sebastian Thomschke 021 */ 022 public interface CollectionFactory 023 { 024 /** 025 * Instantiate an ArrayList like list object 026 * @return a new list 027 */ 028 <ValueType> List<ValueType> createList(); 029 030 /** 031 * Instantiate an ArrayList like list object 032 * @return a new list 033 */ 034 <ValueType> List<ValueType> createList(int initialCapacity); 035 036 /** 037 * Instantiate a HashMap like map object 038 * @return a new map 039 */ 040 <KeyType, ValueType> Map<KeyType, ValueType> createMap(); 041 042 /** 043 * Instantiate a HashMap like map object 044 * @return a new map 045 */ 046 <KeyType, ValueType> Map<KeyType, ValueType> createMap(int initialCapacity); 047 048 /** 049 * Instantiate a HashSet like set object 050 * @return a new set 051 */ 052 <ValueType> Set<ValueType> createSet(); 053 054 /** 055 * Instantiate a HashSet like set object 056 * @return a new set 057 */ 058 <ValueType> Set<ValueType> createSet(int initialCapacity); 059 }