Applying my test/fix patch from COLLECTIONS-261

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/trunk@567711 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Henri Yandell 2007-08-20 14:11:47 +00:00
parent 95a3fecee0
commit 1d5610521f
2 changed files with 22 additions and 6 deletions

View File

@ -416,7 +416,7 @@ public class Flat3Map implements IterableMap, Serializable, Cloneable {
return old;
}
if (key2 == null) {
Object old = value3;
Object old = value2;
hash2 = hash3;
key2 = key3;
value2 = value3;
@ -427,7 +427,7 @@ public class Flat3Map implements IterableMap, Serializable, Cloneable {
return old;
}
if (key1 == null) {
Object old = value3;
Object old = value1;
hash1 = hash3;
key1 = key3;
value1 = value3;
@ -448,7 +448,7 @@ public class Flat3Map implements IterableMap, Serializable, Cloneable {
return old;
}
if (key1 == null) {
Object old = value2;
Object old = value1;
hash1 = hash2;
key1 = key2;
value1 = value2;
@ -483,7 +483,7 @@ public class Flat3Map implements IterableMap, Serializable, Cloneable {
return old;
}
if (hash2 == hashCode && key.equals(key2)) {
Object old = value3;
Object old = value2;
hash2 = hash3;
key2 = key3;
value2 = value3;
@ -494,7 +494,7 @@ public class Flat3Map implements IterableMap, Serializable, Cloneable {
return old;
}
if (hash1 == hashCode && key.equals(key1)) {
Object old = value3;
Object old = value1;
hash1 = hash3;
key1 = key3;
value1 = value3;
@ -515,7 +515,7 @@ public class Flat3Map implements IterableMap, Serializable, Cloneable {
return old;
}
if (hash1 == hashCode && key.equals(key1)) {
Object old = value2;
Object old = value1;
hash1 = hash2;
key1 = key2;
value1 = value2;

View File

@ -390,4 +390,20 @@ public class TestFlat3Map extends AbstractTestIterableMap {
// (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) ) );
}
}