ca.quine.jcommons.transform.set
Class PositiveIntegerMultiTreeSet
java.lang.Object
|
+--java.util.AbstractCollection
|
+--java.util.AbstractSet
|
+--java.util.TreeSet
|
+--ca.quine.jcommons.transform.set.PositiveIntegerMultiTreeSet
- All Implemented Interfaces:
- Cloneable, Collection, Serializable, Set, SortedSet
- public class PositiveIntegerMultiTreeSet
- extends TreeSet
A multi-TreeSet that holds only Integer objects and uses multiplication
instead of addition to form the hashCode(). The "multi"
part means that the same number can be stored more than once in the set.
The primary use of this class will be to hold a set of Integers, and we
will have many sets, all of which will add up to the same number.
In other words, the default hashCode() will return the same
result for all sets. Since we intend to store all of them in a HashSet,
that behaviour is obviously undesirable.
- See Also:
- Serialized Form
PositiveIntegerMultiTreeSet
public PositiveIntegerMultiTreeSet()
PositiveIntegerMultiTreeSet
public PositiveIntegerMultiTreeSet(SortedSet sortedSet)
PositiveIntegerMultiTreeSet
public PositiveIntegerMultiTreeSet(String stringList)
add
public boolean add(int i)
add
public boolean add(Object o)
- Specified by:
add in interface Set- Overrides:
add in class TreeSet
hashCode
public int hashCode()
- Specified by:
hashCode in interface Set- Overrides:
hashCode in class AbstractSet
iterator
public Iterator iterator()
- Specified by:
iterator in interface Set- Overrides:
iterator in class TreeSet
headSet
public SortedSet headSet(Object toElement)
- Specified by:
headSet in interface SortedSet- Overrides:
headSet in class TreeSet
tailSet
public SortedSet tailSet(Object fromElement)
- Specified by:
tailSet in interface SortedSet- Overrides:
tailSet in class TreeSet
contains
public boolean contains(Object o)
- Specified by:
contains in interface Set- Overrides:
contains in class TreeSet
first
public Object first()
- Specified by:
first in interface SortedSet- Overrides:
first in class TreeSet
last
public Object last()
- Specified by:
last in interface SortedSet- Overrides:
last in class TreeSet
remove
public boolean remove(Object o)
- Specified by:
remove in interface Set- Overrides:
remove in class TreeSet
size
public int size()
- Specified by:
size in interface Set- Overrides:
size in class TreeSet
subSet
public SortedSet subSet(Object fromElement,
Object toElement)
- Specified by:
subSet in interface SortedSet- Overrides:
subSet in class TreeSet