org.apache.commons.collections15.map
Class AbstractSortedMapDecorator<K,V>

java.lang.Object
  extended by org.apache.commons.collections15.map.AbstractMapDecorator<K,V>
      extended by org.apache.commons.collections15.map.AbstractSortedMapDecorator<K,V>
All Implemented Interfaces:
Map<K,V>, SortedMap<K,V>
Direct Known Subclasses:
DualTreeBidiMap.ViewMap, FixedSizeSortedMap, UnmodifiableSortedMap

public abstract class AbstractSortedMapDecorator<K,V>
extends AbstractMapDecorator<K,V>
implements SortedMap<K,V>

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: 1.1 $ $Date: 2005/10/11 17:05:32 $
Author:
Matt Hall, John Watkinson, Stephen Colebourne

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Field Summary
 
Fields inherited from class org.apache.commons.collections15.map.AbstractMapDecorator
map
 
Constructor Summary
protected AbstractSortedMapDecorator()
          Constructor only used in deserialization, do not use otherwise.
  AbstractSortedMapDecorator(SortedMap<K,V> map)
          Constructor that wraps (not copies).
 
Method Summary
 Comparator<? super K> comparator()
           
 K firstKey()
           
protected  SortedMap<K,V> getSortedMap()
          Gets the map being decorated.
 SortedMap<K,V> headMap(K toKey)
           
 K lastKey()
           
 SortedMap<K,V> subMap(K fromKey, K toKey)
           
 SortedMap<K,V> tailMap(K fromKey)
           
 
Methods inherited from class org.apache.commons.collections15.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.SortedMap
entrySet, keySet, values
 
Methods inherited from interface java.util.Map
clear, containsKey, containsValue, equals, get, hashCode, isEmpty, put, putAll, remove, size
 

Constructor Detail

AbstractSortedMapDecorator

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

Since:
Commons Collections 3.1

AbstractSortedMapDecorator

public AbstractSortedMapDecorator(SortedMap<K,V> map)
Constructor that wraps (not copies).

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

getSortedMap

protected SortedMap<K,V> getSortedMap()
Gets the map being decorated.

Returns:
the decorated map

comparator

public Comparator<? super K> comparator()
Specified by:
comparator in interface SortedMap<K,V>

firstKey

public K firstKey()
Specified by:
firstKey in interface SortedMap<K,V>

headMap

public SortedMap<K,V> headMap(K toKey)
Specified by:
headMap in interface SortedMap<K,V>

lastKey

public K lastKey()
Specified by:
lastKey in interface SortedMap<K,V>

subMap

public SortedMap<K,V> subMap(K fromKey,
                             K toKey)
Specified by:
subMap in interface SortedMap<K,V>

tailMap

public SortedMap<K,V> tailMap(K fromKey)
Specified by:
tailMap in interface SortedMap<K,V>


Copyright © 2001-2010 Apache Software Foundation. All Rights Reserved.