Fix bug in remove()

from Leo Sutic


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130972 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Stephen Colebourne 2003-02-19 19:54:12 +00:00
parent ae4e066007
commit d7e506ef8e
1 changed files with 15 additions and 16 deletions

View File

@ -1,13 +1,10 @@
/* /*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/StaticBucketMap.java,v 1.6 2002/10/18 07:03:12 bayard Exp $ * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/StaticBucketMap.java,v 1.7 2003/02/19 19:54:12 scolebourne Exp $
* $Revision: 1.6 $
* $Date: 2002/10/18 07:03:12 $
*
* ==================================================================== * ====================================================================
* *
* The Apache Software License, Version 1.1 * The Apache Software License, Version 1.1
* *
* Copyright (c) 1999-2002 The Apache Software Foundation. All rights * Copyright (c) 1999-2003 The Apache Software Foundation. All rights
* reserved. * reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -23,11 +20,11 @@
* distribution. * distribution.
* *
* 3. The end-user documentation included with the redistribution, if * 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement: * any, must include the following acknowledgment:
* "This product includes software developed by the * "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)." * Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself, * Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear. * if and wherever such third-party acknowledgments normally appear.
* *
* 4. The names "The Jakarta Project", "Commons", and "Apache Software * 4. The names "The Jakarta Project", "Commons", and "Apache Software
* Foundation" must not be used to endorse or promote products derived * Foundation" must not be used to endorse or promote products derived
@ -36,7 +33,7 @@
* *
* 5. Products derived from this software may not be called "Apache" * 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written * nor may "Apache" appear in their names without prior written
* permission of the Apache Group. * permission of the Apache Software Foundation.
* *
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
@ -132,12 +129,14 @@ import java.util.NoSuchElementException;
* iterations, or if you can make your own guarantees about how bulk * iterations, or if you can make your own guarantees about how bulk
* operations will affect the map.<P> * operations will affect the map.<P>
* *
* @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a> * @since Commons Collections 2.1
* @author <a href="mailto:g-froehlich@gmx.de">Gerhard Froehlich</a> * @version $Revision: 1.7 $ $Date: 2003/02/19 19:54:12 $
* @author <a href="mailto:mas@apache.org">Michael A. Smith</a> *
* @author Paul Jack * @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
* @version CVS $Revision: 1.6 $ $Date: 2002/10/18 07:03:12 $ * @author <a href="mailto:g-froehlich@gmx.de">Gerhard Froehlich</a>
* @since Collections 2.1 * @author <a href="mailto:mas@apache.org">Michael A. Smith</a>
* @author Paul Jack
* @author Leo Sutic
*/ */
public final class StaticBucketMap implements Map public final class StaticBucketMap implements Map
{ {
@ -401,7 +400,7 @@ public final class StaticBucketMap implements Map
while( n != null ) while( n != null )
{ {
if( n.key == null || ( n.key != null && n.key.equals( key ) ) ) if( n.key == key || ( n.key != null && n.key.equals( key ) ) )
{ {
// Remove this node from the linked list of nodes. // Remove this node from the linked list of nodes.
if( null == prev ) if( null == prev )