|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.notuvy.util.SortedCountingSet<T>
public class SortedCountingSet<T>
Mainly present a SortedSet, but keep a count of how many times each entry was added. The underlying Collection uses equality check to determine existence User: murali
Constructor Summary | |
---|---|
SortedCountingSet()
|
Method Summary | |
---|---|
void |
add(T pKey)
Add the given element to the collection. |
long |
countFor(T pKey)
Give the number of times the given entity exists in the collection. |
void |
expect(T pKey)
Initialize and element. |
void |
expectAll(Collection<T> pKeys)
Initialize with the given collection of elements. |
Set<T> |
keySet()
Give the complete set of entities in this collection. |
long |
remove(T pKey)
Remove the given entity if it exists in the collection. |
int |
size()
The total number of (unique) entities in the collection. |
String |
toString()
|
int |
total()
The weighted count of all entities. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public SortedCountingSet()
Method Detail |
---|
public void add(T pKey)
pKey
- The entity to add.public void expect(T pKey)
pKey
- The element to initialize.public void expectAll(Collection<T> pKeys)
pKeys
- A generic collection of elements.public Set<T> keySet()
public long countFor(T pKey)
pKey
- The entity to check.
public long remove(T pKey)
pKey
- The entity to remove.
public int size()
public int total()
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |