public class AvlTreeSet<T extends java.lang.Comparable<T>> extends java.lang.Object implements ReifiedSet<T>
Constructor and Description |
---|
AvlTreeSet()
Default constructor
|
AvlTreeSet(java.lang.Class<?> genericTypeParameter)
Constructor for initializing with the generic type parameter
|
AvlTreeSet(java.lang.Iterable<? extends T> iterable)
Constructor initializes with an initial collection and this class's generic type parameter
|
AvlTreeSet(java.lang.Iterable<? extends T> iterable,
java.lang.Class<?> genericTypeParameter)
Constructor initializes with an initial collection and this class's generic type parameter
|
AvlTreeSet(ReifiedIterable<T> iterable)
Constructor initializes from another reified collection
|
AvlTreeSet(T[] array)
Constructor initializes with an array
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(T item)
Adds an item to the collection This is an O(log2(n)) operation.
|
void |
clear()
Clears the collection.
|
boolean |
contains(T item)
Returns true if an item is contained in the collection.
|
void |
difference(java.util.Set<? extends T> otherSet)
This operation removes from this set all items that are common between both sets.
|
java.lang.Class<?> |
getGenericTypeParameter()
Returns the class generic type parameters.
|
void |
intersect(java.util.Set<? extends T> otherSet)
This operation only keeps elements that are common between the two sets.
|
java.util.Iterator<T> |
iterator()
Returns an ascending key order iterator over the set.
|
boolean |
remove(T item)
Removes an item from the collection.
|
int |
size()
Returns the collection size.
|
T[] |
toArray()
Puts all elements in an array and returns them.
|
ReifiedList<T> |
toList()
Puts all elements in a list and returns them.
|
void |
union(java.util.Set<? extends T> otherSet)
This operation combines this set with another set i.e.
|
public AvlTreeSet()
SuperTypeTokenException
- When called without using anonymous class semantics.public AvlTreeSet(java.lang.Class<?> genericTypeParameter)
java.lang.NullPointerException
- When the generic type parameter is null.public AvlTreeSet(ReifiedIterable<T> iterable)
java.lang.NullPointerException
- When the argument is nullpublic AvlTreeSet(java.lang.Iterable<? extends T> iterable)
java.lang.NullPointerException
- When the argument is nullSuperTypeTokenException
- When called without using anonymous class semantics.public AvlTreeSet(java.lang.Iterable<? extends T> iterable, java.lang.Class<?> genericTypeParameter)
java.lang.NullPointerException
- When an argument is nullpublic AvlTreeSet(T[] array)
java.lang.NullPointerException
- When an argument is nullpublic void clear()
clear
in interface IValueStore<T extends java.lang.Comparable<T>>
public boolean add(T item)
add
in interface IValueStore<T extends java.lang.Comparable<T>>
item
- The item to add.java.lang.NullPointerException
- When the item is null.public boolean contains(T item)
contains
in interface IValueStore<T extends java.lang.Comparable<T>>
item
- The item to find.java.lang.NullPointerException
- When the item is null.public java.util.Iterator<T> iterator()
public boolean remove(T item)
remove
in interface IValueStore<T extends java.lang.Comparable<T>>
item
- The item to find.java.lang.NullPointerException
- When the item is null.public int size()
size
in interface IValueStore<T extends java.lang.Comparable<T>>
public T[] toArray()
toArray
in interface IValueStore<T extends java.lang.Comparable<T>>
public ReifiedList<T> toList()
toList
in interface IValueStore<T extends java.lang.Comparable<T>>
public void union(java.util.Set<? extends T> otherSet)
union
in interface ReifiedSet<T extends java.lang.Comparable<T>>
java.lang.NullPointerException
- If the other set is null.public void intersect(java.util.Set<? extends T> otherSet)
intersect
in interface ReifiedSet<T extends java.lang.Comparable<T>>
java.lang.NullPointerException
- When the other set is null.public void difference(java.util.Set<? extends T> otherSet)
difference
in interface ReifiedSet<T extends java.lang.Comparable<T>>
java.lang.NullPointerException
- If the other set is null.public java.lang.Class<?> getGenericTypeParameter()
getGenericTypeParameter
in interface ReifiedIterable<T extends java.lang.Comparable<T>>