Class DualTreeBidiMap<K,V>

    • Constructor Detail

      • DualTreeBidiMap

        public DualTreeBidiMap()
        Creates an empty DualTreeBidiMap
      • DualTreeBidiMap

        public DualTreeBidiMap(Map<? extends K,? extends V> map)
        Constructs a DualTreeBidiMap and copies the mappings from specified Map.
        Parameters:
        map - the map whose mappings are to be placed in this map
      • DualTreeBidiMap

        public DualTreeBidiMap(Comparator<? super K> keyComparator,
                               Comparator<? super V> valueComparator)
        Constructs a DualTreeBidiMap using the specified Comparator.
        Parameters:
        keyComparator - the comparator
        valueComparator - the values comparator to use
      • DualTreeBidiMap

        protected DualTreeBidiMap(Map<K,V> normalMap,
                                  Map<V,K> reverseMap,
                                  BidiMap<V,K> inverseBidiMap)
        Constructs a DualTreeBidiMap that decorates the specified maps.
        Parameters:
        normalMap - the normal direction map
        reverseMap - the reverse direction map
        inverseBidiMap - the inverse BidiMap
    • Method Detail

      • createBidiMap

        protected DualTreeBidiMap<V,K> createBidiMap(Map<V,K> normalMap,
                                                     Map<K,V> reverseMap,
                                                     BidiMap<K,V> inverseMap)
        Creates a new instance of this object.
        Specified by:
        createBidiMap in class  AbstractDualBidiMap<K,V>
        Parameters:
        normalMap - the normal direction map
        reverseMap - the reverse direction map
        inverseMap - the inverse BidiMap
        Returns:
        new bidi map
      • comparator

        public Comparator<? super K> comparator()
      • valueComparator

        public Comparator<? super V> valueComparator()
        Description copied from interface: SortedBidiMap
        Get the comparator used for the values in the value-to-key map aspect.
        Specified by:
        valueComparator in interface  SortedBidiMap<K,V>
        Returns:
        Comparator
      • firstKey

        public K firstKey()
        Description copied from interface: OrderedMap
        Gets the first key currently in this map.
        Specified by:
        firstKey in interface  SortedMap<K,V>
        Specified by:
        firstKey in interface  OrderedMap<K,V>
        Returns:
        the first key currently in this map
      • lastKey

        public K lastKey()
        Description copied from interface: OrderedMap
        Gets the last key currently in this map.
        Specified by:
        lastKey in interface  SortedMap<K,V>
        Specified by:
        lastKey in interface  OrderedMap<K,V>
        Returns:
        the last key currently in this map
      • nextKey

        public K nextKey(K key)
        Description copied from interface: OrderedMap
        Gets the next key after the one specified.
        Specified by:
        nextKey in interface  OrderedMap<K,V>
        Parameters:
        key - the key to search for next from
        Returns:
        the next key, null if no match or at end
      • previousKey

        public K previousKey(K key)
        Description copied from interface: OrderedMap
        Gets the previous key before the one specified.
        Specified by:
        previousKey in interface  OrderedMap<K,V>
        Parameters:
        key - the key to search for previous from
        Returns:
        the previous key, null if no match or at start
      • inverseBidiMap

        public SortedBidiMap<V,K> inverseBidiMap()
        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<K,V>
        Specified by:
        inverseBidiMap in interface  OrderedBidiMap<K,V>
        Specified by:
        inverseBidiMap in interface  SortedBidiMap<K,V>
        Overrides:
        inverseBidiMap in class  AbstractDualBidiMap<K,V>
        Returns:
        an inverted bidirectional map