Class SyncSortedMap

  • All Implemented Interfaces:
    java.util.Map, java.util.SortedMap

    public class SyncSortedMap
    extends SyncMap
    implements java.util.SortedMap
    SyncSortedMaps wrap Sync-based control around java.util.SortedMaps. They support the following additional reader operations over SyncMap: comparator, subMap, headMap, tailMap, firstKey, lastKey.

    [ Introduction to this package. ]

    See Also:
    SyncCollection
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface java.util.Map

        java.util.Map.Entry<K extends java.lang.Object,​V extends java.lang.Object>
    • Constructor Summary

      Constructors 
      Constructor Description
      SyncSortedMap​(java.util.SortedMap map, ReadWriteLock rwl)
      Create a new SyncSortedMap protecting the given map, and using the given ReadWriteLock to control reader and writer methods.
      SyncSortedMap​(java.util.SortedMap map, Sync sync)
      Create a new SyncSortedMap protecting the given map, and using the given sync to control both reader and writer methods.
      SyncSortedMap​(java.util.SortedMap map, Sync readLock, Sync writeLock)
      Create a new SyncSortedMap protecting the given map, and using the given pair of locks to control reader and writer methods.
    • Constructor Detail

      • SyncSortedMap

        public SyncSortedMap​(java.util.SortedMap map,
                             Sync sync)
        Create a new SyncSortedMap protecting the given map, and using the given sync to control both reader and writer methods. Common, reasonable choices for the sync argument include Mutex, ReentrantLock, and Semaphores initialized to 1.
      • SyncSortedMap

        public SyncSortedMap​(java.util.SortedMap map,
                             ReadWriteLock rwl)
        Create a new SyncSortedMap protecting the given map, and using the given ReadWriteLock to control reader and writer methods.
      • SyncSortedMap

        public SyncSortedMap​(java.util.SortedMap map,
                             Sync readLock,
                             Sync writeLock)
        Create a new SyncSortedMap protecting the given map, and using the given pair of locks to control reader and writer methods.
    • Method Detail

      • baseSortedMap

        protected java.util.SortedMap baseSortedMap()
      • comparator

        public java.util.Comparator comparator()
        Specified by:
        comparator in interface java.util.SortedMap
      • firstKey

        public java.lang.Object firstKey()
        Specified by:
        firstKey in interface java.util.SortedMap
      • lastKey

        public java.lang.Object lastKey()
        Specified by:
        lastKey in interface java.util.SortedMap
      • subMap

        public java.util.SortedMap subMap​(java.lang.Object fromElement,
                                          java.lang.Object toElement)
        Specified by:
        subMap in interface java.util.SortedMap
      • headMap

        public java.util.SortedMap headMap​(java.lang.Object toElement)
        Specified by:
        headMap in interface java.util.SortedMap
      • tailMap

        public java.util.SortedMap tailMap​(java.lang.Object fromElement)
        Specified by:
        tailMap in interface java.util.SortedMap