You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ba...@apache.org on 2009/09/15 07:57:41 UTC
svn commit: r815134 -
/commons/proper/collections/trunk/src/test/org/apache/commons/collections/MapPerformance.java
Author: bayard
Date: Tue Sep 15 05:57:41 2009
New Revision: 815134
URL: http://svn.apache.org/viewvc?rev=815134&view=rev
Log:
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
------------------------------------------------------------------------
Modified:
commons/proper/collections/trunk/src/test/org/apache/commons/collections/MapPerformance.java
Modified: commons/proper/collections/trunk/src/test/org/apache/commons/collections/MapPerformance.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/org/apache/commons/collections/MapPerformance.java?rev=815134&r1=815133&r2=815134&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/org/apache/commons/collections/MapPerformance.java (original)
+++ commons/proper/collections/trunk/src/test/org/apache/commons/collections/MapPerformance.java Tue Sep 15 05:57:41 2009
@@ -17,11 +17,11 @@
package org.apache.commons.collections;
import java.util.Collection;
-import java.util.Collections;
+//import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
-import java.util.TreeMap;
+//import java.util.TreeMap;
import org.apache.commons.collections.map.Flat3Map;
@@ -43,18 +43,17 @@
}
private static void testAll() {
- Map dummyMap = new DummyMap();
- Map hashMap = new HashMap();
+ Map<String, String> dummyMap = new DummyMap<String, String>();
+ Map<String, String> hashMap = new HashMap<String, String>();
// hashMap.put("Alpha", "A");
// hashMap.put("Beta", "B");
// hashMap.put("Gamma", "C");
// hashMap.put("Delta", "D");
- Map flatMap = new Flat3Map(hashMap);
+ Map<String, String> flatMap = new Flat3Map<String, String>(hashMap);
System.out.println(flatMap);
- Map unmodHashMap = Collections.unmodifiableMap(new HashMap(hashMap));
- Map fastHashMap = new FastHashMap(hashMap);
- Map treeMap = new TreeMap(hashMap);
- Map seqMap = new SequencedHashMap(hashMap);
+// Map<String, String> unmodHashMap = Collections.unmodifiableMap(new HashMap<String, String>(hashMap));
+// Map fastHashMap = new FastHashMap(hashMap);
+// Map<String, String> treeMap = new TreeMap<String, String>(hashMap);
// Map linkedMap = new LinkedHashMap(hashMap);
// Map syncMap = Collections.unmodifiableMap(new HashMap(hashMap));
// Map bucketMap = new StaticBucketMap();
@@ -110,9 +109,9 @@
// 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;
- int total = 0;
+// int total = 0;
start = System.currentTimeMillis();
for (int i = RUNS; i > 0; i--) {
// if (map.get("Alpha") != null) total++;
@@ -134,7 +133,7 @@
// ----------------------------------------------------------------------
- private static class DummyMap implements Map {
+ private static class DummyMap<K, V> implements Map<K, V> {
public void clear() {
}
public boolean containsKey(Object key) {
@@ -143,30 +142,30 @@
public boolean containsValue(Object value) {
return false;
}
- public Set entrySet() {
+ public Set<Map.Entry<K, V>> entrySet() {
return null;
}
- public Object get(Object key) {
+ public V get(Object key) {
return null;
}
public boolean isEmpty() {
return false;
}
- public Set keySet() {
+ public Set<K> keySet() {
return null;
}
- public Object put(Object key, Object value) {
+ public V put(K key, V value) {
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;
}
public int size() {
return 0;
}
- public Collection values() {
+ public Collection<V> values() {
return null;
}
}