Class UnmodifiableSortedBidiMap

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

@Deprecated(since="2021-04-30") public final class UnmodifiableSortedBidiMap extends AbstractSortedBidiMapDecorator implements Unmodifiable
Deprecated.
Apache Commons Collections version 3.x is being deprecated from AEMaaCS. The upgraded version 4.4 of Commons Collections is already included as replacement. Customers are advised to upgrade to this version of the library. Please note: the package name was changed to org.apache.commons.collections4. Further note that there are AEM APIs currently exposing the old collections classes; these will be updated in upcoming releases.
Decorates another SortedBidiMap to ensure it can't be altered.
Since:
Commons Collections 3.0
  • Method Details

    • decorate

      public static SortedBidiMap decorate(SortedBidiMap map)
      Deprecated.
      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
      Throws:
      IllegalArgumentException - if map is null
    • clear

      public void clear()
      Deprecated.
      Specified by:
      clear in interface Map
      Overrides:
      clear in class AbstractMapDecorator
    • put

      public Object put(Object key, Object value)
      Deprecated.
      Description copied from interface: BidiMap
      Puts the key-value pair into the map, replacing any previous pair.

      When adding a key-value pair, the value may already exist in the map against a different key. That mapping is removed, to ensure that the value only occurs once in the inverse map.

        BidiMap map1 = new DualHashBidiMap();
        map.put("A","B");  // contains A mapped to B, as per Map
        map.put("A","C");  // contains A mapped to C, as per Map
      
        BidiMap map2 = new DualHashBidiMap();
        map.put("A","B");  // contains A mapped to B, as per Map
        map.put("C","B");  // contains C mapped to B, key A is removed
       
      Specified by:
      put in interface BidiMap
      Specified by:
      put in interface Map
      Overrides:
      put in class AbstractMapDecorator
      Parameters:
      key - the key to store
      value - the value to store
      Returns:
      the previous value mapped to this key
    • putAll

      public void putAll(Map mapToCopy)
      Deprecated.
      Specified by:
      putAll in interface Map
      Overrides:
      putAll in class AbstractMapDecorator
    • remove

      public Object remove(Object key)
      Deprecated.
      Specified by:
      remove in interface Map
      Overrides:
      remove in class AbstractMapDecorator
    • entrySet

      public Set entrySet()
      Deprecated.
      Specified by:
      entrySet in interface Map
      Specified by:
      entrySet in interface SortedMap
      Overrides:
      entrySet in class AbstractMapDecorator
    • keySet

      public Set keySet()
      Deprecated.
      Specified by:
      keySet in interface Map
      Specified by:
      keySet in interface SortedMap
      Overrides:
      keySet in class AbstractMapDecorator
    • values

      public Collection values()
      Deprecated.
      Specified by:
      values in interface Map
      Specified by:
      values in interface SortedMap
      Overrides:
      values in class AbstractMapDecorator
    • removeValue

      public Object removeValue(Object value)
      Deprecated.
      Description copied from interface: BidiMap
      Removes the key-value pair that is currently mapped to the specified value (optional operation).

      If the value is not contained in the map, null is returned.

      Implementations should seek to make this method perform equally as well as remove(Object).

      Specified by:
      removeValue in interface BidiMap
      Overrides:
      removeValue in class AbstractBidiMapDecorator
      Parameters:
      value - the value to find the key-value pair for
      Returns:
      the key that was removed, null if nothing removed
    • mapIterator

      public MapIterator mapIterator()
      Deprecated.
      Description copied from interface: BidiMap
      Obtains a MapIterator over the map.

      A map iterator is an efficient way of iterating over maps. It does not require that the map is stored using Map Entry objects which can increase performance.

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

      public BidiMap inverseBidiMap()
      Deprecated.
      Description copied from interface: BidiMap
      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 Map.

      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.

      Specified by:
      inverseBidiMap in interface BidiMap
      Specified by:
      inverseBidiMap in interface OrderedBidiMap
      Specified by:
      inverseBidiMap in interface SortedBidiMap
      Overrides:
      inverseBidiMap in class AbstractBidiMapDecorator
      Returns:
      an inverted bidirectional map
    • orderedMapIterator

      public OrderedMapIterator orderedMapIterator()
      Deprecated.
      Description copied from interface: OrderedMap
      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 class AbstractOrderedBidiMapDecorator
      Returns:
      a map iterator
    • inverseOrderedBidiMap

      public OrderedBidiMap inverseOrderedBidiMap()
      Deprecated.
      Description copied from interface: OrderedBidiMap
      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 equally.

      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.

      Specified by:
      inverseOrderedBidiMap in interface OrderedBidiMap
      Overrides:
      inverseOrderedBidiMap in class AbstractOrderedBidiMapDecorator
      Returns:
      an inverted bidirectional map
    • inverseSortedBidiMap

      public SortedBidiMap inverseSortedBidiMap()
      Deprecated.
      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
      Overrides:
      inverseSortedBidiMap in class AbstractSortedBidiMapDecorator
      Returns:
      an inverted bidirectional map
    • subMap

      public SortedMap subMap(Object fromKey, Object toKey)
      Deprecated.
      Specified by:
      subMap in interface SortedMap
      Overrides:
      subMap in class AbstractSortedBidiMapDecorator
    • headMap

      public SortedMap headMap(Object toKey)
      Deprecated.
      Specified by:
      headMap in interface SortedMap
      Overrides:
      headMap in class AbstractSortedBidiMapDecorator
    • tailMap

      public SortedMap tailMap(Object fromKey)
      Deprecated.
      Specified by:
      tailMap in interface SortedMap
      Overrides:
      tailMap in class AbstractSortedBidiMapDecorator