01: /*******************************************************************************
02: * Portions created by Sebastian Thomschke are copyright (c) 2005-2007 Sebastian
03: * Thomschke.
04: *
05: * All Rights Reserved. This program and the accompanying materials
06: * are made available under the terms of the Eclipse Public License v1.0
07: * which accompanies this distribution, and is available at
08: * http://www.eclipse.org/legal/epl-v10.html
09: *
10: * Contributors:
11: * Sebastian Thomschke - initial implementation.
12: *******************************************************************************/package net.sf.oval.collection;
13:
14: import java.util.ArrayList;
15: import java.util.HashMap;
16: import java.util.HashSet;
17: import java.util.List;
18: import java.util.Map;
19: import java.util.Set;
20:
21: /**
22: * @author Sebastian Thomschke
23: */
24: public class CollectionFactoryJDKImpl implements CollectionFactory {
25: public <ValueType> List<ValueType> createList() {
26: return new ArrayList<ValueType>();
27: }
28:
29: public <ValueType> List<ValueType> createList(
30: final int initialCapacity) {
31: return new ArrayList<ValueType>(initialCapacity);
32: }
33:
34: public <KeyType, ValueType> Map<KeyType, ValueType> createMap() {
35: return new HashMap<KeyType, ValueType>();
36: }
37:
38: public <KeyType, ValueType> Map<KeyType, ValueType> createMap(
39: final int initialCapacity) {
40: return new HashMap<KeyType, ValueType>(initialCapacity);
41: }
42:
43: public <ValueType> Set<ValueType> createSet() {
44: return new HashSet<ValueType>();
45: }
46:
47: public <ValueType> Set<ValueType> createSet(
48: final int initialCapacity) {
49: return new HashSet<ValueType>(initialCapacity);
50: }
51: }
|