org.apache.commons.collections.bidimap

Class UnmodifiableSortedBidiMap

Implemented Interfaces:
BidiMap, IterableMap, Map, OrderedBidiMap, OrderedMap, SortedBidiMap, SortedMap, Unmodifiable

public final class UnmodifiableSortedBidiMap
extends AbstractSortedBidiMapDecorator
implements Unmodifiable

Decorates another SortedBidiMap to ensure it can't be altered.
Version:
$Revision: 1.5 $ $Date: 2004/05/15 12:13:03 $
Author:
Stephen Colebourne
Since:
Commons Collections 3.0

Field Summary

Fields inherited from class org.apache.commons.collections.map.AbstractMapDecorator

map

Method Summary

void
clear()
static SortedBidiMap
decorate(SortedBidiMap map)
Factory method to create an unmodifiable map.
Set
entrySet()
SortedMap
headMap(Object toKey)
BidiMap
inverseBidiMap()
OrderedBidiMap
inverseOrderedBidiMap()
SortedBidiMap
inverseSortedBidiMap()
Set
keySet()
MapIterator
mapIterator()
Obtains a MapIterator over the map.
OrderedMapIterator
orderedMapIterator()
Obtains an OrderedMapIterator over the map.
Object
put(Object key, Object value)
void
putAll(Map mapToCopy)
Object
remove(Object key)
Object
removeValue(Object value)
SortedMap
subMap(Object fromKey, Object toKey)
SortedMap
tailMap(Object fromKey)
Collection
values()

Methods inherited from class org.apache.commons.collections.bidimap.AbstractSortedBidiMapDecorator

comparator, getSortedBidiMap, headMap, inverseSortedBidiMap, subMap, tailMap

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

Method Details

clear

public void clear()
Overrides:
clear in interface AbstractMapDecorator

decorate

public static SortedBidiMap decorate(SortedBidiMap map)
Factory method to create an unmodifiable map.

If the map passed in is already unmodifiable, it is returned.

Parameters:
map - the map to decorate, must not be null
Returns:
an unmodifiable SortedBidiMap

entrySet

public Set entrySet()
Overrides:
entrySet in interface AbstractMapDecorator

headMap

public SortedMap headMap(Object toKey)
Overrides:
headMap in interface AbstractSortedBidiMapDecorator

inverseBidiMap

public BidiMap inverseBidiMap()
Specified by:
inverseBidiMap in interface SortedBidiMap
inverseBidiMap in interface OrderedBidiMap
inverseBidiMap in interface BidiMap
Overrides:
inverseBidiMap in interface AbstractBidiMapDecorator

inverseOrderedBidiMap

public OrderedBidiMap inverseOrderedBidiMap()
Specified by:
inverseOrderedBidiMap in interface OrderedBidiMap
Overrides:
inverseOrderedBidiMap in interface AbstractOrderedBidiMapDecorator

inverseSortedBidiMap

public SortedBidiMap inverseSortedBidiMap()
Specified by:
inverseSortedBidiMap in interface SortedBidiMap
Overrides:
inverseSortedBidiMap in interface AbstractSortedBidiMapDecorator

keySet

public Set keySet()
Overrides:
keySet in interface AbstractMapDecorator

mapIterator

public MapIterator mapIterator()
Obtains a MapIterator over the map.

A map iterator is an efficient way of iterating over maps. There is no need to access the entry set or cast to Map Entry objects.

 IterableMap map = new HashedMap();
 MapIterator it = map.mapIterator();
 while (it.hasNext()) {
   Object key = it.next();
   Object value = it.getValue();
   it.setValue("newValue");
 }
 
Specified by:
mapIterator in interface BidiMap
mapIterator in interface IterableMap
Overrides:
mapIterator in interface AbstractBidiMapDecorator
Returns:
a map iterator

orderedMapIterator

public OrderedMapIterator orderedMapIterator()
Obtains an OrderedMapIterator over the map.

A ordered map iterator is an efficient way of iterating over maps in both directions.

 BidiMap map = new TreeBidiMap();
 MapIterator it = map.mapIterator();
 while (it.hasNext()) {
   Object key = it.next();
   Object value = it.getValue();
   it.setValue("newValue");
   Object previousKey = it.previous();
 }
 
Specified by:
orderedMapIterator in interface OrderedMap
Overrides:
orderedMapIterator in interface AbstractOrderedBidiMapDecorator
Returns:
a map iterator

put

public Object put(Object key,
                  Object value)
Specified by:
put in interface BidiMap
Overrides:
put in interface AbstractMapDecorator

putAll

public void putAll(Map mapToCopy)
Overrides:
putAll in interface AbstractMapDecorator

remove

public Object remove(Object key)
Overrides:
remove in interface AbstractMapDecorator

removeValue

public Object removeValue(Object value)
Specified by:
removeValue in interface BidiMap
Overrides:
removeValue in interface AbstractBidiMapDecorator

subMap

public SortedMap subMap(Object fromKey,
                        Object toKey)
Overrides:
subMap in interface AbstractSortedBidiMapDecorator

tailMap

public SortedMap tailMap(Object fromKey)
Overrides:
tailMap in interface AbstractSortedBidiMapDecorator

values

public Collection values()
Overrides:
values in interface AbstractMapDecorator

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