Merging from -r468106:814127 of collections_jdk5_branch - namely where this code was generified; mostly in r738956.

Also see the following revisions:

    ------------------------------------------------------------------------
    r471163 | scolebourne | 2006-11-04 02:56:39 -0800 (Sat, 04 Nov 2006) | 1 line
    
    Remove FastArrayList, FastHashMap, FastTreeMap
    ------------------------------------------------------------------------
    r468687 | scolebourne | 2006-10-28 05:53:28 -0700 (Sat, 28 Oct 2006) | 1 line
    
    COLLECTIONS-229 - Remove deprecated classes and code
    ------------------------------------------------------------------------


git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/trunk@815134 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Henri Yandell 2009-09-15 05:57:41 +00:00
parent 6f76f2b205
commit a5422f9b40
1 changed files with 18 additions and 19 deletions

View File

@ -17,11 +17,11 @@
package org.apache.commons.collections; package org.apache.commons.collections;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; //import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.TreeMap; //import java.util.TreeMap;
import org.apache.commons.collections.map.Flat3Map; import org.apache.commons.collections.map.Flat3Map;
@ -43,18 +43,17 @@ public class MapPerformance {
} }
private static void testAll() { private static void testAll() {
Map dummyMap = new DummyMap(); Map<String, String> dummyMap = new DummyMap<String, String>();
Map hashMap = new HashMap(); Map<String, String> hashMap = new HashMap<String, String>();
// hashMap.put("Alpha", "A"); // hashMap.put("Alpha", "A");
// hashMap.put("Beta", "B"); // hashMap.put("Beta", "B");
// hashMap.put("Gamma", "C"); // hashMap.put("Gamma", "C");
// hashMap.put("Delta", "D"); // hashMap.put("Delta", "D");
Map flatMap = new Flat3Map(hashMap); Map<String, String> flatMap = new Flat3Map<String, String>(hashMap);
System.out.println(flatMap); System.out.println(flatMap);
Map unmodHashMap = Collections.unmodifiableMap(new HashMap(hashMap)); // Map<String, String> unmodHashMap = Collections.unmodifiableMap(new HashMap<String, String>(hashMap));
Map fastHashMap = new FastHashMap(hashMap); // Map fastHashMap = new FastHashMap(hashMap);
Map treeMap = new TreeMap(hashMap); // Map<String, String> treeMap = new TreeMap<String, String>(hashMap);
Map seqMap = new SequencedHashMap(hashMap);
// Map linkedMap = new LinkedHashMap(hashMap); // Map linkedMap = new LinkedHashMap(hashMap);
// Map syncMap = Collections.unmodifiableMap(new HashMap(hashMap)); // Map syncMap = Collections.unmodifiableMap(new HashMap(hashMap));
// Map bucketMap = new StaticBucketMap(); // Map bucketMap = new StaticBucketMap();
@ -110,9 +109,9 @@ public class MapPerformance {
// test(doubleMap, " DoubleMap "); // test(doubleMap, " DoubleMap ");
} }
private static void test(Map map, String name) { private static void test(Map<String, String> map, String name) {
long start = 0, end = 0; long start = 0, end = 0;
int total = 0; // int total = 0;
start = System.currentTimeMillis(); start = System.currentTimeMillis();
for (int i = RUNS; i > 0; i--) { for (int i = RUNS; i > 0; i--) {
// if (map.get("Alpha") != null) total++; // if (map.get("Alpha") != null) total++;
@ -134,7 +133,7 @@ public class MapPerformance {
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
private static class DummyMap implements Map { private static class DummyMap<K, V> implements Map<K, V> {
public void clear() { public void clear() {
} }
public boolean containsKey(Object key) { public boolean containsKey(Object key) {
@ -143,30 +142,30 @@ public class MapPerformance {
public boolean containsValue(Object value) { public boolean containsValue(Object value) {
return false; return false;
} }
public Set entrySet() { public Set<Map.Entry<K, V>> entrySet() {
return null; return null;
} }
public Object get(Object key) { public V get(Object key) {
return null; return null;
} }
public boolean isEmpty() { public boolean isEmpty() {
return false; return false;
} }
public Set keySet() { public Set<K> keySet() {
return null; return null;
} }
public Object put(Object key, Object value) { public V put(K key, V value) {
return null; return null;
} }
public void putAll(Map t) { public void putAll(Map<? extends K, ? extends V> t) {
} }
public Object remove(Object key) { public V remove(Object key) {
return null; return null;
} }
public int size() { public int size() {
return 0; return 0;
} }
public Collection values() { public Collection<V> values() {
return null; return null;
} }
} }