Rename BidiMap removeKey to removeValue
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@131335 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
c34bf0a54c
commit
64f3f8e11b
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/Attic/AbstractDualBidiMap.java,v 1.8 2003/11/02 19:48:39 scolebourne Exp $
|
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/Attic/AbstractDualBidiMap.java,v 1.9 2003/11/08 18:40:17 scolebourne Exp $
|
||||||
* ====================================================================
|
* ====================================================================
|
||||||
*
|
*
|
||||||
* The Apache Software License, Version 1.1
|
* The Apache Software License, Version 1.1
|
||||||
|
@ -67,7 +67,6 @@ import org.apache.commons.collections.decorators.AbstractIteratorDecorator;
|
||||||
import org.apache.commons.collections.decorators.AbstractMapEntryDecorator;
|
import org.apache.commons.collections.decorators.AbstractMapEntryDecorator;
|
||||||
import org.apache.commons.collections.iterators.MapIterator;
|
import org.apache.commons.collections.iterators.MapIterator;
|
||||||
import org.apache.commons.collections.iterators.ResetableMapIterator;
|
import org.apache.commons.collections.iterators.ResetableMapIterator;
|
||||||
import org.apache.commons.collections.pairs.TiedMapEntry;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstract <code>BidiMap</code> implemented using two maps.
|
* Abstract <code>BidiMap</code> implemented using two maps.
|
||||||
|
@ -76,7 +75,7 @@ import org.apache.commons.collections.pairs.TiedMapEntry;
|
||||||
* <code>createMap</code> method.
|
* <code>createMap</code> method.
|
||||||
*
|
*
|
||||||
* @since Commons Collections 3.0
|
* @since Commons Collections 3.0
|
||||||
* @version $Id: AbstractDualBidiMap.java,v 1.8 2003/11/02 19:48:39 scolebourne Exp $
|
* @version $Id: AbstractDualBidiMap.java,v 1.9 2003/11/08 18:40:17 scolebourne Exp $
|
||||||
*
|
*
|
||||||
* @author Matthew Hawthorne
|
* @author Matthew Hawthorne
|
||||||
* @author Stephen Colebourne
|
* @author Stephen Colebourne
|
||||||
|
@ -240,7 +239,7 @@ public abstract class AbstractDualBidiMap implements BidiMap {
|
||||||
return maps[1].get(value);
|
return maps[1].get(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object removeKey(Object value) {
|
public Object removeValue(Object value) {
|
||||||
Object key = null;
|
Object key = null;
|
||||||
if (maps[1].containsKey(value)) {
|
if (maps[1].containsKey(value)) {
|
||||||
key = maps[1].remove(value);
|
key = maps[1].remove(value);
|
||||||
|
@ -615,18 +614,6 @@ public abstract class AbstractDualBidiMap implements BidiMap {
|
||||||
canRemove = false;
|
canRemove = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map.Entry asMapEntry() {
|
|
||||||
return new TiedMapEntry(map, getKey()) {
|
|
||||||
public Object setValue(Object value) {
|
|
||||||
if (map.maps[1].containsKey(value) &&
|
|
||||||
map.maps[1].get(value) != last.getKey()) {
|
|
||||||
throw new IllegalArgumentException("Cannot use setValue() when the object being set is already in the map");
|
|
||||||
}
|
|
||||||
return super.setValue(value);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
if (last == null) {
|
if (last == null) {
|
||||||
return "MapIterator[" + getKey() + "=" + getValue() + "]";
|
return "MapIterator[" + getKey() + "=" + getValue() + "]";
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/BidiMap.java,v 1.5 2003/11/02 15:27:53 scolebourne Exp $
|
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/BidiMap.java,v 1.6 2003/11/08 18:40:17 scolebourne Exp $
|
||||||
* ====================================================================
|
* ====================================================================
|
||||||
*
|
*
|
||||||
* The Apache Software License, Version 1.1
|
* The Apache Software License, Version 1.1
|
||||||
|
@ -75,7 +75,7 @@ import org.apache.commons.collections.iterators.MapIterator;
|
||||||
*
|
*
|
||||||
* @see org.apache.commons.collections.DualHashBidiMap
|
* @see org.apache.commons.collections.DualHashBidiMap
|
||||||
* @since Commons Collections 3.0
|
* @since Commons Collections 3.0
|
||||||
* @version $Revision: 1.5 $ $Date: 2003/11/02 15:27:53 $
|
* @version $Revision: 1.6 $ $Date: 2003/11/08 18:40:17 $
|
||||||
*
|
*
|
||||||
* @author Stephen Colebourne
|
* @author Stephen Colebourne
|
||||||
*/
|
*/
|
||||||
|
@ -168,7 +168,7 @@ public interface BidiMap extends Map {
|
||||||
* @throws UnsupportedOperationException if this method is not supported
|
* @throws UnsupportedOperationException if this method is not supported
|
||||||
* by the implementation
|
* by the implementation
|
||||||
*/
|
*/
|
||||||
Object removeKey(Object value);
|
Object removeValue(Object value);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a view of this map where the keys and values are reversed.
|
* Gets a view of this map where the keys and values are reversed.
|
||||||
|
|
Loading…
Reference in New Issue