Merging from -r468106:814127 of collections_jdk5_branch - namely where this code was generified; mostly in r738956.
Also see the following revisions: ------------------------------------------------------------------------ r471189 | scolebourne | 2006-11-04 05:57:57 -0800 (Sat, 04 Nov 2006) | 1 line Remove getMap(), getOrderedMap() and getSortedMap() - use decorated() ------------------------------------------------------------------------ r471180 | scolebourne | 2006-11-04 05:27:44 -0800 (Sat, 04 Nov 2006) | 1 line Abstract*Decorator - Generify and use covariant return types ------------------------------------------------------------------------ git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/trunk@815072 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
fdb0ea56f9
commit
e61486f5dc
|
@ -16,7 +16,6 @@
|
|||
*/
|
||||
package org.apache.commons.collections.map;
|
||||
|
||||
import org.apache.commons.collections.MapIterator;
|
||||
import org.apache.commons.collections.OrderedMap;
|
||||
import org.apache.commons.collections.OrderedMapIterator;
|
||||
|
||||
|
@ -37,8 +36,8 @@ import org.apache.commons.collections.OrderedMapIterator;
|
|||
*
|
||||
* @author Stephen Colebourne
|
||||
*/
|
||||
public abstract class AbstractOrderedMapDecorator
|
||||
extends AbstractMapDecorator implements OrderedMap {
|
||||
public abstract class AbstractOrderedMapDecorator<K, V> extends AbstractMapDecorator<K, V>
|
||||
implements OrderedMap<K, V> {
|
||||
|
||||
/**
|
||||
* Constructor only used in deserialization, do not use otherwise.
|
||||
|
@ -54,7 +53,7 @@ public abstract class AbstractOrderedMapDecorator
|
|||
* @param map the map to decorate, must not be null
|
||||
* @throws IllegalArgumentException if the collection is null
|
||||
*/
|
||||
public AbstractOrderedMapDecorator(OrderedMap map) {
|
||||
public AbstractOrderedMapDecorator(OrderedMap<K, V> map) {
|
||||
super(map);
|
||||
}
|
||||
|
||||
|
@ -63,33 +62,29 @@ public abstract class AbstractOrderedMapDecorator
|
|||
*
|
||||
* @return the decorated map
|
||||
*/
|
||||
protected OrderedMap getOrderedMap() {
|
||||
return (OrderedMap) map;
|
||||
protected OrderedMap<K, V> decorated() {
|
||||
return (OrderedMap<K, V>) super.decorated();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
public Object firstKey() {
|
||||
return getOrderedMap().firstKey();
|
||||
public K firstKey() {
|
||||
return decorated().firstKey();
|
||||
}
|
||||
|
||||
public Object lastKey() {
|
||||
return getOrderedMap().lastKey();
|
||||
public K lastKey() {
|
||||
return decorated().lastKey();
|
||||
}
|
||||
|
||||
public Object nextKey(Object key) {
|
||||
return getOrderedMap().nextKey(key);
|
||||
public K nextKey(K key) {
|
||||
return decorated().nextKey(key);
|
||||
}
|
||||
|
||||
public Object previousKey(Object key) {
|
||||
return getOrderedMap().previousKey(key);
|
||||
public K previousKey(K key) {
|
||||
return decorated().previousKey(key);
|
||||
}
|
||||
|
||||
public MapIterator mapIterator() {
|
||||
return getOrderedMap().mapIterator();
|
||||
}
|
||||
|
||||
public OrderedMapIterator orderedMapIterator() {
|
||||
return getOrderedMap().orderedMapIterator();
|
||||
public OrderedMapIterator<K, V> mapIterator() {
|
||||
return decorated().mapIterator();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue