org.apache.commons.collections.map
Class AbstractSortedMapDecorator

java.lang.Object
  extended by org.apache.commons.collections.map.AbstractMapDecorator
      extended by org.apache.commons.collections.map.AbstractSortedMapDecorator
All Implemented Interfaces:
java.util.Map, java.util.SortedMap
Direct Known Subclasses:
DualTreeBidiMap.ViewMap, FixedSizeSortedMap, UnmodifiableSortedMap

public abstract class AbstractSortedMapDecorator
extends AbstractMapDecorator
implements java.util.SortedMap

Provides a base decorator that enables additional functionality to be added to a Map via decoration.

Methods are forwarded directly to the decorated map.

This implementation does not perform any special processing with the map views. Instead it simply returns the set/collection from the wrapped map. This may be undesirable, for example if you are trying to write a validating implementation it would provide a loophole around the validation. But, you might want that loophole, so this class is kept simple.

Since:
Commons Collections 3.0
Version:
$Revision: 646777 $ $Date: 2008-04-10 13:33:15 +0100 (Thu, 10 Apr 2008) $
Author:
Stephen Colebourne

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry
 
Field Summary
 
Fields inherited from class org.apache.commons.collections.map.AbstractMapDecorator
map
 
Constructor Summary
protected AbstractSortedMapDecorator()
          Constructor only used in deserialization, do not use otherwise.
  AbstractSortedMapDecorator(java.util.SortedMap map)
          Constructor that wraps (not copies).
 
Method Summary
 java.util.Comparator comparator()
           
 java.lang.Object firstKey()
           
protected  java.util.SortedMap getSortedMap()
          Gets the map being decorated.
 java.util.SortedMap headMap(java.lang.Object toKey)
           
 java.lang.Object lastKey()
           
 java.util.SortedMap subMap(java.lang.Object fromKey, java.lang.Object toKey)
           
 java.util.SortedMap tailMap(java.lang.Object fromKey)
           
 
Methods inherited from class org.apache.commons.collections.map.AbstractMapDecorator
clear, containsKey, containsValue, entrySet, equals, get, getMap, hashCode, isEmpty, keySet, put, putAll, remove, size, toString, values
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, values
 

Constructor Detail

AbstractSortedMapDecorator

protected AbstractSortedMapDecorator()
Constructor only used in deserialization, do not use otherwise.

Since:
Commons Collections 3.1

AbstractSortedMapDecorator

public AbstractSortedMapDecorator(java.util.SortedMap map)
Constructor that wraps (not copies).

Parameters:
map - the map to decorate, must not be null
Throws:
java.lang.IllegalArgumentException - if the collection is null
Method Detail

getSortedMap

protected java.util.SortedMap getSortedMap()
Gets the map being decorated.

Returns:
the decorated map

comparator

public java.util.Comparator comparator()
Specified by:
comparator in interface java.util.SortedMap

firstKey

public java.lang.Object firstKey()
Specified by:
firstKey in interface java.util.SortedMap

headMap

public java.util.SortedMap headMap(java.lang.Object toKey)
Specified by:
headMap in interface java.util.SortedMap

lastKey

public java.lang.Object lastKey()
Specified by:
lastKey in interface java.util.SortedMap

subMap

public java.util.SortedMap subMap(java.lang.Object fromKey,
                                  java.lang.Object toKey)
Specified by:
subMap in interface java.util.SortedMap

tailMap

public java.util.SortedMap tailMap(java.lang.Object fromKey)
Specified by:
tailMap in interface java.util.SortedMap


Copyright © 2001-2008 The Apache Software Foundation. All Rights Reserved.