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 2007/08/20 16:11:48 UTC
svn commit: r567711 - in /commons/proper/collections/trunk/src:
java/org/apache/commons/collections/map/Flat3Map.java
test/org/apache/commons/collections/map/TestFlat3Map.java
Author: bayard
Date: Mon Aug 20 07:11:47 2007
New Revision: 567711
URL: http://svn.apache.org/viewvc?rev=567711&view=rev
Log:
Applying my test/fix patch from COLLECTIONS-261
Modified:
commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/Flat3Map.java
commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestFlat3Map.java
Modified: commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/Flat3Map.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/Flat3Map.java?rev=567711&r1=567710&r2=567711&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/Flat3Map.java (original)
+++ commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/Flat3Map.java Mon Aug 20 07:11:47 2007
@@ -416,7 +416,7 @@
return old;
}
if (key2 == null) {
- Object old = value3;
+ Object old = value2;
hash2 = hash3;
key2 = key3;
value2 = value3;
@@ -427,7 +427,7 @@
return old;
}
if (key1 == null) {
- Object old = value3;
+ Object old = value1;
hash1 = hash3;
key1 = key3;
value1 = value3;
@@ -448,7 +448,7 @@
return old;
}
if (key1 == null) {
- Object old = value2;
+ Object old = value1;
hash1 = hash2;
key1 = key2;
value1 = value2;
@@ -483,7 +483,7 @@
return old;
}
if (hash2 == hashCode && key.equals(key2)) {
- Object old = value3;
+ Object old = value2;
hash2 = hash3;
key2 = key3;
value2 = value3;
@@ -494,7 +494,7 @@
return old;
}
if (hash1 == hashCode && key.equals(key1)) {
- Object old = value3;
+ Object old = value1;
hash1 = hash3;
key1 = key3;
value1 = value3;
@@ -515,7 +515,7 @@
return old;
}
if (hash1 == hashCode && key.equals(key1)) {
- Object old = value2;
+ Object old = value1;
hash1 = hash2;
key1 = key2;
value1 = value2;
Modified: commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestFlat3Map.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestFlat3Map.java?rev=567711&r1=567710&r2=567711&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestFlat3Map.java (original)
+++ commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestFlat3Map.java Mon Aug 20 07:11:47 2007
@@ -390,4 +390,20 @@
// (java.io.Serializable) map,
// "D:/dev/collections/data/test/Flat3Map.fullCollection.version3.1.obj");
// }
+
+ public void testCollections261() {
+ Flat3Map m = new Flat3Map();
+ m.put( new Integer(1), new Integer(1) );
+ m.put( new Integer(0), new Integer(0) );
+ assertEquals( new Integer(1), m.remove( new Integer(1) ) );
+ assertEquals( new Integer(0), m.remove( new Integer(0) ) );
+
+ m.put( new Integer(2), new Integer(2) );
+ m.put( new Integer(1), new Integer(1) );
+ m.put( new Integer(0), new Integer(0) );
+ assertEquals( new Integer(2), m.remove( new Integer(2) ) );
+ assertEquals( new Integer(1), m.remove( new Integer(1) ) );
+ assertEquals( new Integer(0), m.remove( new Integer(0) ) );
+ }
+
}