com.faunos.util
Class CopyOnWriteSortedMap<K,V>
java.lang.Object
com.faunos.util.AbstractCopyOnWriteMap<K,V,SortedMap<K,V>>
com.faunos.util.CopyOnWriteSortedMap<K,V>
- All Implemented Interfaces:
- Cloneable, Map<K,V>, SortedMap<K,V>
public class CopyOnWriteSortedMap<K,V>
- extends AbstractCopyOnWriteMap<K,V,SortedMap<K,V>>
- implements SortedMap<K,V>, Cloneable
A copy-on-write SortedMap implementation using a backing
java.util.TreeMap.
- Author:
- Babak Farhang
- See Also:
AbstractCopyOnWriteMap
Nested classes/interfaces inherited from interface java.util.Map |
Map.Entry<K,V> |
Methods inherited from class com.faunos.util.AbstractCopyOnWriteMap |
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, setMap, size, values |
Methods inherited from interface java.util.Map |
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, values |
CopyOnWriteSortedMap
public CopyOnWriteSortedMap()
- Creates an empty instance.
CopyOnWriteSortedMap
public CopyOnWriteSortedMap(Comparator<? super K> comparator)
- Creates an instance using the specified comparator.
CopyOnWriteSortedMap
public CopyOnWriteSortedMap(CopyOnWriteSortedMap<K,V> copy)
- Copy constructor. This makes a shallow copy. Note this class is
also Cloneable.
- Throws:
NullPointerException
- if copy is null.
emptyMap
protected final SortedMap<K,V> emptyMap()
- Description copied from class:
AbstractCopyOnWriteMap
- Returns an implementation-specific empty map. The returned map
may be read-only. An implementation ought to return the same
empty instance across all instances of its class.
- Specified by:
emptyMap
in class AbstractCopyOnWriteMap<K,V,SortedMap<K,V>>
newMap
protected SortedMap<K,V> newMap()
- Returns a new TreeMap.
- Specified by:
newMap
in class AbstractCopyOnWriteMap<K,V,SortedMap<K,V>>
comparator
public Comparator<? super K> comparator()
- Specified by:
comparator
in interface SortedMap<K,V>
firstKey
public K firstKey()
- Specified by:
firstKey
in interface SortedMap<K,V>
headMap
public SortedMap<K,V> headMap(K toKey)
- Specified by:
headMap
in interface SortedMap<K,V>
lastKey
public K lastKey()
- Specified by:
lastKey
in interface SortedMap<K,V>
subMap
public SortedMap<K,V> subMap(K fromKey,
K toKey)
- Specified by:
subMap
in interface SortedMap<K,V>
tailMap
public SortedMap<K,V> tailMap(K fromKey)
- Specified by:
tailMap
in interface SortedMap<K,V>