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 gnu.trove.THashMap;
15: import gnu.trove.THashSet;
16:
17: import java.util.ArrayList;
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 CollectionFactoryTroveImpl implements CollectionFactory {
26: public <ValueType> List<ValueType> createList() {
27: return new ArrayList<ValueType>();
28: }
29:
30: public <ValueType> List<ValueType> createList(
31: final int initialCapacity) {
32: return new ArrayList<ValueType>(initialCapacity);
33: }
34:
35: public <KeyType, ValueType> Map<KeyType, ValueType> createMap() {
36: return new THashMap<KeyType, ValueType>();
37: }
38:
39: public <KeyType, ValueType> Map<KeyType, ValueType> createMap(
40: final int initialCapacity) {
41: return new THashMap<KeyType, ValueType>(initialCapacity);
42: }
43:
44: public <ValueType> Set<ValueType> createSet() {
45: return new THashSet<ValueType>();
46: }
47:
48: public <ValueType> Set<ValueType> createSet(
49: final int initialCapacity) {
50: return new THashSet<ValueType>(initialCapacity);
51: }
52: }
|