de.fu_berlin.ties.util
Class SortedMultiValueMap<K,V>

java.lang.Object
  extended by de.fu_berlin.ties.util.MultiValueMap<K,V>
      extended by de.fu_berlin.ties.util.SortedMultiValueMap<K,V>
Type Parameters:
K - the type of keys
V - the type of values

public class SortedMultiValueMap<K,V>
extends MultiValueMap<K,V>

A MultiValueMap that sorts the values stored for each key, discarding duplicates. For this purpose, TreeSets are used for inner collections. By default, the keys are sorted as well, by wrapping a TreeMap. This can be changed by specifying a different kind of map to wrap in the constructor.

Version:
$Revision: 1.5 $, $Date: 2006/10/21 16:04:27 $, $Author: siefkes $
Author:
Christian Siefkes

Constructor Summary
SortedMultiValueMap()
          Creates a new instance, wrapping a TreeMap.
SortedMultiValueMap(Map<K,Collection<V>> wrappedMap)
          Creates a new instance.
 
Method Summary
protected  Collection<V> createCollection(Collection<? extends V> coll)
          Creates a new instance of the map value Collection container. This implementation returns a TreeSet.
 
Methods inherited from class de.fu_berlin.ties.util.MultiValueMap
clear, containsKey, containsValue, containsValue, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, remove, size, size, totalSize, values
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SortedMultiValueMap

public SortedMultiValueMap()
Creates a new instance, wrapping a TreeMap.


SortedMultiValueMap

public SortedMultiValueMap(Map<K,Collection<V>> wrappedMap)
Creates a new instance.

Parameters:
wrappedMap - wrapped map used as storage, e.g. a HashMap or a TreeMap
Method Detail

createCollection

protected Collection<V> createCollection(Collection<? extends V> coll)
Creates a new instance of the map value Collection container.

This method can be overridden to use your own collection type. This implementation returns a TreeSet.

Overrides:
createCollection in class MultiValueMap<K,V>
Parameters:
coll - the collection to copy, may be null
Returns:
the new collection


Copyright © 2003-2007 Christian Siefkes. All Rights Reserved.