public class SharedAvlTreeSet<T extends java.lang.Comparable<T>> extends AvlTreeSet<T> implements IShared
Constructor and Description |
---|
SharedAvlTreeSet()
Default constructor
|
SharedAvlTreeSet(java.lang.Class<?> genericTypeParameter)
Constructor for initializing with the generic type parameter
|
SharedAvlTreeSet(java.lang.Iterable<? extends T> iterable)
Constructor initializes with an initial collection and this class's generic type parameter
|
SharedAvlTreeSet(java.lang.Iterable<? extends T> iterable,
java.lang.Class<?> genericTypeParameter)
Constructor initializes with an initial collection and this class's generic type parameter
|
SharedAvlTreeSet(ReifiedIterable<T> iterable)
Constructor initializes from another reified collection
|
SharedAvlTreeSet(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.
|
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 enumerator of a copy of the collection.
|
void |
lock()
Locks the collection
|
boolean |
remove(T item)
Removes an item from the collection.
|
java.lang.Iterable<java.lang.Boolean> |
replaceAll(java.util.Collection<? extends T> items)
Clears the set and bulk adds the specified items to avoid locking/unlocking continuously.
|
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.
|
void |
unlock()
Unlocks the collection
|
getGenericTypeParameter
public SharedAvlTreeSet()
SuperTypeTokenException
- When called without using anonymous class semantics.public SharedAvlTreeSet(java.lang.Class<?> genericTypeParameter)
java.lang.NullPointerException
- When the generic type parameter is null.public SharedAvlTreeSet(ReifiedIterable<T> iterable)
java.lang.NullPointerException
- When the argument is nullpublic SharedAvlTreeSet(java.lang.Iterable<? extends T> iterable)
java.lang.NullPointerException
- When the argument is nullSuperTypeTokenException
- When called without using anonymous class semantics.public SharedAvlTreeSet(java.lang.Iterable<? extends T> iterable, java.lang.Class<?> genericTypeParameter)
java.lang.NullPointerException
- When an argument is nullpublic SharedAvlTreeSet(T[] array)
java.lang.NullPointerException
- When an argument is nullpublic boolean add(T item)
add
in interface IValueStore<T extends java.lang.Comparable<T>>
add
in class AvlTreeSet<T extends java.lang.Comparable<T>>
item
- The item to add.public void clear()
clear
in interface IValueStore<T extends java.lang.Comparable<T>>
clear
in class AvlTreeSet<T extends java.lang.Comparable<T>>
public boolean contains(T item)
contains
in interface IValueStore<T extends java.lang.Comparable<T>>
contains
in class AvlTreeSet<T extends java.lang.Comparable<T>>
item
- The item to find.public java.util.Iterator<T> iterator()
public boolean remove(T item)
remove
in interface IValueStore<T extends java.lang.Comparable<T>>
remove
in class AvlTreeSet<T extends java.lang.Comparable<T>>
item
- The item to find.public java.lang.Iterable<java.lang.Boolean> replaceAll(java.util.Collection<? extends T> items)
java.lang.NullPointerException
- When the items is nullpublic int size()
size
in interface IValueStore<T extends java.lang.Comparable<T>>
size
in class AvlTreeSet<T extends java.lang.Comparable<T>>
public T[] toArray()
toArray
in interface IValueStore<T extends java.lang.Comparable<T>>
toArray
in class AvlTreeSet<T extends java.lang.Comparable<T>>
public ReifiedList<T> toList()
toList
in interface IValueStore<T extends java.lang.Comparable<T>>
toList
in class AvlTreeSet<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>>
union
in class AvlTreeSet<T extends java.lang.Comparable<T>>
public void intersect(java.util.Set<? extends T> otherSet)
intersect
in interface ReifiedSet<T extends java.lang.Comparable<T>>
intersect
in class AvlTreeSet<T extends java.lang.Comparable<T>>
public void difference(java.util.Set<? extends T> otherSet)
difference
in interface ReifiedSet<T extends java.lang.Comparable<T>>
difference
in class AvlTreeSet<T extends java.lang.Comparable<T>>