org.omnaest.utils.structure.map.decorator
Class SortedMapDecorator<K,V>

java.lang.Object
  extended by org.omnaest.utils.structure.map.decorator.SortedMapDecorator<K,V>
All Implemented Interfaces:
Map<K,V>, SortedMap<K,V>

public class SortedMapDecorator<K,V>
extends Object
implements SortedMap<K,V>

A decorator for any SortedMap implementation

Author:
Omnaest
See Also:
MapDecorator

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Field Summary
protected  SortedMap<K,V> sortedMap
           
 
Constructor Summary
protected SortedMapDecorator()
           
  SortedMapDecorator(SortedMap<K,V> sortedMap)
           
 
Method Summary
 void clear()
           
 Comparator<? super K> comparator()
           
 boolean containsKey(Object key)
           
 boolean containsValue(Object value)
           
 Set<Map.Entry<K,V>> entrySet()
           
 boolean equals(Object obj)
           
 K firstKey()
           
 V get(Object key)
           
protected  Map<K,V> getMap()
           
 int hashCode()
           
 SortedMap<K,V> headMap(K toKey)
           
 boolean isEmpty()
           
 Set<K> keySet()
           
 K lastKey()
           
 V put(K key, V value)
           
 void putAll(Map<? extends K,? extends V> m)
           
 V remove(Object key)
           
protected  void setMap(SortedMap<K,V> sortedMap)
           
 void setSortedMap(SortedMap<K,V> sortedMap)
           
 int size()
           
 SortedMap<K,V> subMap(K fromKey, K toKey)
           
 SortedMap<K,V> tailMap(K fromKey)
           
 String toString()
           
 Collection<V> values()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

sortedMap

protected SortedMap<K,V> sortedMap
Constructor Detail

SortedMapDecorator

public SortedMapDecorator(SortedMap<K,V> sortedMap)
Parameters:
sortedMap -
See Also:
SortedMapDecorator

SortedMapDecorator

protected SortedMapDecorator()
See Also:
SortedMapDecorator
Method Detail

size

public int size()
Specified by:
size in interface Map<K,V>
Returns:
See Also:
Map.size()

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Map<K,V>
Returns:
See Also:
Map.isEmpty()

containsKey

public boolean containsKey(Object key)
Specified by:
containsKey in interface Map<K,V>
Parameters:
key -
Returns:
See Also:
Map.containsKey(java.lang.Object)

containsValue

public boolean containsValue(Object value)
Specified by:
containsValue in interface Map<K,V>
Parameters:
value -
Returns:
See Also:
Map.containsValue(java.lang.Object)

get

public V get(Object key)
Specified by:
get in interface Map<K,V>
Parameters:
key -
Returns:
See Also:
Map.get(java.lang.Object)

put

public V put(K key,
             V value)
Specified by:
put in interface Map<K,V>
Parameters:
key -
value -
Returns:
See Also:
Map.put(java.lang.Object, java.lang.Object)

remove

public V remove(Object key)
Specified by:
remove in interface Map<K,V>
Parameters:
key -
Returns:
See Also:
Map.remove(java.lang.Object)

putAll

public void putAll(Map<? extends K,? extends V> m)
Specified by:
putAll in interface Map<K,V>
Parameters:
m -
See Also:
Map.putAll(java.util.Map)

clear

public void clear()
Specified by:
clear in interface Map<K,V>
See Also:
Map.clear()

keySet

public Set<K> keySet()
Specified by:
keySet in interface Map<K,V>
Specified by:
keySet in interface SortedMap<K,V>
Returns:
See Also:
Map.keySet()

values

public Collection<V> values()
Specified by:
values in interface Map<K,V>
Specified by:
values in interface SortedMap<K,V>
Returns:
See Also:
Map.values()

entrySet

public Set<Map.Entry<K,V>> entrySet()
Specified by:
entrySet in interface Map<K,V>
Specified by:
entrySet in interface SortedMap<K,V>
Returns:
See Also:
Map.entrySet()

equals

public boolean equals(Object obj)
Specified by:
equals in interface Map<K,V>
Overrides:
equals in class Object

hashCode

public int hashCode()
Specified by:
hashCode in interface Map<K,V>
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object

getMap

protected Map<K,V> getMap()
Returns:
the map

setMap

protected void setMap(SortedMap<K,V> sortedMap)
Parameters:
sortedMap - the map to set

comparator

public Comparator<? super K> comparator()
Specified by:
comparator in interface SortedMap<K,V>
Returns:
See Also:
SortedMap.comparator()

subMap

public SortedMap<K,V> subMap(K fromKey,
                             K toKey)
Specified by:
subMap in interface SortedMap<K,V>
Parameters:
fromKey -
toKey -
Returns:
See Also:
SortedMap.subMap(java.lang.Object, java.lang.Object)

headMap

public SortedMap<K,V> headMap(K toKey)
Specified by:
headMap in interface SortedMap<K,V>
Parameters:
toKey -
Returns:
See Also:
SortedMap.headMap(java.lang.Object)

tailMap

public SortedMap<K,V> tailMap(K fromKey)
Specified by:
tailMap in interface SortedMap<K,V>
Parameters:
fromKey -
Returns:
See Also:
SortedMap.tailMap(java.lang.Object)

firstKey

public K firstKey()
Specified by:
firstKey in interface SortedMap<K,V>
Returns:
See Also:
SortedMap.firstKey()

lastKey

public K lastKey()
Specified by:
lastKey in interface SortedMap<K,V>
Returns:
See Also:
SortedMap.lastKey()

setSortedMap

public void setSortedMap(SortedMap<K,V> sortedMap)
Parameters:
sortedMap - the sortedMap to set


Copyright © 2013. All Rights Reserved.