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.ArrayList;
16  import java.util.LinkedHashMap;
17  import java.util.LinkedHashSet;
18  import java.util.List;
19  import java.util.Map;
20  import java.util.Set;
21  
22  /**
23   * @author Sebastian Thomschke
24   */
25  public class CollectionFactoryJDKImpl implements CollectionFactory
26  {
27  	/**
28  	 * {@inheritDoc}
29  	 */
30  	public <ValueType> List<ValueType> createList()
31  	{
32  		return new ArrayList<ValueType>();
33  	}
34  
35  	/**
36  	 * {@inheritDoc}
37  	 */
38  	public <ValueType> List<ValueType> createList(final int initialCapacity)
39  	{
40  		return new ArrayList<ValueType>(initialCapacity);
41  	}
42  
43  	/**
44  	 * {@inheritDoc}
45  	 */
46  	public <KeyType, ValueType> Map<KeyType, ValueType> createMap()
47  	{
48  		return new LinkedHashMap<KeyType, ValueType>();
49  	}
50  
51  	/**
52  	 * {@inheritDoc}
53  	 */
54  	public <KeyType, ValueType> Map<KeyType, ValueType> createMap(final int initialCapacity)
55  	{
56  		return new LinkedHashMap<KeyType, ValueType>(initialCapacity);
57  	}
58  
59  	/**
60  	 * {@inheritDoc}
61  	 */
62  	public <ValueType> Set<ValueType> createSet()
63  	{
64  		return new LinkedHashSet<ValueType>();
65  	}
66  
67  	/**
68  	 * {@inheritDoc}
69  	 */
70  	public <ValueType> Set<ValueType> createSet(final int initialCapacity)
71  	{
72  		return new LinkedHashSet<ValueType>(initialCapacity);
73  	}
74  }