## org.apache.commons.collections.bidimap
Class AbstractSortedBidiMapDecorator

    java.lang.Object
      org.apache.commons.collections.map.AbstractMapDecorator
          org.apache.commons.collections.bidimap.AbstractBidiMapDecorator
              org.apache.commons.collections.bidimap.AbstractOrderedBidiMapDecorator
                  org.apache.commons.collections.bidimap.AbstractSortedBidiMapDecorator

All Implemented Interfaces:
  java.util.Map, java.util.SortedMap, BidiMap, IterableMap, OrderedBidiMap, OrderedMap, SortedBidiMap

Direct Known Subclasses:
  UnmodifiableSortedBidiMap

    public abstract class AbstractSortedBidiMapDecorator

extends AbstractOrderedBidiMapDecorator
implements SortedBidiMap

Provides a base decorator that enables additional functionality to be added to a SortedBidiMap 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 inverse 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`

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
`AbstractSortedBidiMapDecorator(SortedBidiMap map)` Constructor that wraps (not copies).

Method Summary
`java.util.Comparator` `comparator()`
`protected SortedBidiMap` `getSortedBidiMap()` Gets the map being decorated.
`java.util.SortedMap` `headMap(java.lang.Object toKey)`
`SortedBidiMap` `inverseSortedBidiMap()` Gets a view of this map where the keys and values are reversed.
`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.bidimap.AbstractOrderedBidiMapDecorator
`firstKey, getOrderedBidiMap, inverseOrderedBidiMap, lastKey, nextKey, orderedMapIterator, previousKey`

Methods inherited from class org.apache.commons.collections.bidimap.AbstractBidiMapDecorator
`getBidiMap, getKey, inverseBidiMap, mapIterator, removeValue`

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 org.apache.commons.collections.SortedBidiMap
`inverseBidiMap`

Methods inherited from interface org.apache.commons.collections.OrderedBidiMap
`inverseOrderedBidiMap`

Methods inherited from interface org.apache.commons.collections.BidiMap
`getKey, mapIterator, put, removeValue`

Methods inherited from interface java.util.Map
`clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, putAll, remove, size, values`

Methods inherited from interface org.apache.commons.collections.OrderedMap
`firstKey, lastKey, nextKey, orderedMapIterator, previousKey`

Methods inherited from interface java.util.Map
`clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, putAll, remove, size, values`

Methods inherited from interface java.util.SortedMap
`firstKey, lastKey`

Constructor Detail

### AbstractSortedBidiMapDecorator

    public AbstractSortedBidiMapDecorator(SortedBidiMap 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

### getSortedBidiMap

    protected SortedBidiMap getSortedBidiMap()

  Gets the map being decorated.

  Returns:
    the decorated map

### inverseSortedBidiMap

    public SortedBidiMap inverseSortedBidiMap()

  Description copied from interface: `SortedBidiMap`
  Gets a view of this map where the keys and values are reversed.

  Changes to one map will be visible in the other and vice versa. This enables both directions of the map to be accessed as a `SortedMap`.

  Implementations should seek to avoid creating a new object every time this method is called. See `AbstractMap.values()` etc. Calling this method on the inverse map should return the original.

  The inverse map returned by `inverseBidiMap()` should be the same object as returned by this method.

  Specified by:
    `inverseSortedBidiMap` in interface `SortedBidiMap`
  Returns:
    an inverted bidirectional map

### comparator

    public java.util.Comparator comparator()

  Specified by:
    `comparator` 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`

### headMap

    public java.util.SortedMap headMap(java.lang.Object toKey)

  Specified by:
    `headMap` 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.