net.sf.colossus.util
Class MultiSet<T>

java.lang.Object
  extended by net.sf.colossus.util.MultiSet<T>

public class MultiSet<T>
extends java.lang.Object

Class MultiSet is a set that can contain more than one of the same element, built around a HashMap that maps objects to Integer counts.


Field Summary
private  java.util.Map<T,java.lang.Integer> map
           
 
Constructor Summary
MultiSet()
           
 
Method Summary
 void add(T key)
           
 boolean contains(T key)
           
 int count(T key)
           
 boolean isEmpty()
           
 java.util.Collection<T> keySet()
           
 int max()
           
 boolean remove(T key)
          Remove one of key from the set, if present.
 int size()
           
 java.util.Collection<java.lang.Integer> values()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

map

private final java.util.Map<T,java.lang.Integer> map
Constructor Detail

MultiSet

public MultiSet()
Method Detail

add

public void add(T key)

remove

public boolean remove(T key)
Remove one of key from the set, if present. Return true iff it was present.


size

public int size()

contains

public boolean contains(T key)

count

public int count(T key)

keySet

public java.util.Collection<T> keySet()

values

public java.util.Collection<java.lang.Integer> values()

isEmpty

public boolean isEmpty()

max

public int max()