public class HashSetMulti<V> extends Object implements Iterable<V>
HashMapMulti
as HashSet
is to HashMap
, but note that it does not truly implement the set
abstraction since the number of times a value is entered is significant.Constructor and Description |
---|
HashSetMulti()
Construct a new, empty set.
|
Modifier and Type | Method and Description |
---|---|
void |
add(V obj)
Add an object to the set.
|
HashSetMulti<V> |
asUnmodifiable()
Produce a new set that is a read-only version of this one.
|
boolean |
contains(V obj)
Test if a given object is a member of the set (i.e., that it has been
added more times than it has been removed).
|
static <V> HashSetMulti<V> |
emptySet()
Produce an empty set.
|
boolean |
isEmpty()
Test if this set is empty.
|
Iterator<V> |
iterator()
Obtain an iterator over the objects in this set (not repeating
multiples).
|
void |
remove(V obj)
Remove an object from the set.
|
public void add(V obj)
obj
- The object to add.public HashSetMulti<V> asUnmodifiable()
public boolean contains(V obj)
obj
- The object to test for.public static <V> HashSetMulti<V> emptySet()
public boolean isEmpty()
public Iterator<V> iterator()
public void remove(V obj)
obj
- The object to remove.Copyright © 2017. All rights reserved.