public class RefCountedSet<K> extends Object
Constructor and Description |
---|
RefCountedSet()
Constructor.
|
RefCountedSet(Map<K,Integer> refSet,
int numValues) |
Modifier and Type | Method and Description |
---|---|
boolean |
add(K key)
Add a key to the set.
|
void |
add(K key,
int numReferences)
Add a key to the set with the given number of references.
|
void |
clear()
Clear out the collection.
|
Iterator<Map.Entry<K,Integer>> |
entryIterator()
Returns an iterator over the entry set.
|
int |
getNumValues() |
Map<K,Integer> |
getRefSet() |
Iterator<K> |
keyIterator()
Returns a key iterator.
|
boolean |
remove(K key)
Removed a key to the set.
|
boolean |
removeAll(K key)
Remove a key from the set regardless of the number of references.
|
void |
setNumValues(int numValues) |
int |
size()
Returns the number of values in the collection.
|
public void clear()
public boolean add(K key)
key
- to addpublic void add(K key, int numReferences)
key
- to addnumReferences
- initial number of referencespublic boolean remove(K key)
key
- to addIllegalStateException
- is a key is removed that wasn't added to the mappublic boolean removeAll(K key)
key
- to addIllegalStateException
- if a key is removed that wasn't added to the mappublic Iterator<Map.Entry<K,Integer>> entryIterator()
public int size()
public int getNumValues()
public void setNumValues(int numValues)