View Javadoc
1   /*******************************************************************************
2    * Portions created by Sebastian Thomschke are copyright (c) 2005-2011 Sebastian
3    * Thomschke.
4    *
5    * All Rights Reserved. This program and the accompanying materials
6    * are made available under the terms of the Eclipse Public License v1.0
7    * which accompanies this distribution, and is available at
8    * http://www.eclipse.org/legal/epl-v10.html
9    *
10   * Contributors:
11   *     Sebastian Thomschke - initial implementation.
12   *******************************************************************************/
13  package net.sf.oval.collection;
14  
15  import java.util.List;
16  import java.util.Map;
17  import java.util.Set;
18  
19  /**
20   * @author Sebastian Thomschke
21   */
22  public interface CollectionFactory
23  {
24  	/**
25  	 * Instantiate an ArrayList like list object
26  	 * @return a new list
27  	 */
28  	<ValueType> List<ValueType> createList();
29  
30  	/**
31  	 * Instantiate an ArrayList like list object
32  	 * @return a new list
33  	 */
34  	<ValueType> List<ValueType> createList(int initialCapacity);
35  
36  	/**
37  	 * Instantiate a HashMap like map object
38  	 * @return a new map
39  	 */
40  	<KeyType, ValueType> Map<KeyType, ValueType> createMap();
41  
42  	/**
43  	 * Instantiate a HashMap like map object
44  	 * @return a new map
45  	 */
46  	<KeyType, ValueType> Map<KeyType, ValueType> createMap(int initialCapacity);
47  
48  	/**
49  	 * Instantiate a HashSet like set object
50  	 * @return a new set
51  	 */
52  	<ValueType> Set<ValueType> createSet();
53  
54  	/**
55  	 * Instantiate a HashSet like set object
56  	 * @return a new set
57  	 */
58  	<ValueType> Set<ValueType> createSet(int initialCapacity);
59  }