From e61486f5dc02ac96af52166f0ecf17e58ee1eddc Mon Sep 17 00:00:00 2001 From: Henri Yandell Date: Tue, 15 Sep 2009 05:55:55 +0000 Subject: [PATCH] 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 --- .../map/AbstractOrderedMapDecorator.java | 35 ++++++++----------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/src/java/org/apache/commons/collections/map/AbstractOrderedMapDecorator.java b/src/java/org/apache/commons/collections/map/AbstractOrderedMapDecorator.java index 437a598ec..2f1ebd8e5 100644 --- a/src/java/org/apache/commons/collections/map/AbstractOrderedMapDecorator.java +++ b/src/java/org/apache/commons/collections/map/AbstractOrderedMapDecorator.java @@ -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 extends AbstractMapDecorator + implements OrderedMap { /** * 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 map) { super(map); } @@ -63,33 +62,29 @@ public abstract class AbstractOrderedMapDecorator * * @return the decorated map */ - protected OrderedMap getOrderedMap() { - return (OrderedMap) map; + protected OrderedMap decorated() { + return (OrderedMap) 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 mapIterator() { + return decorated().mapIterator(); } }