Package net.sf.colossus.util
Class MultiSet<T>
- java.lang.Object
-
- 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.
-
-
Constructor Summary
Constructors Constructor Description MultiSet()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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()
-
-
-
Field Detail
-
map
private final java.util.Map<T,java.lang.Integer> map
-
-
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()
-
-