|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectit.unimi.dsi.fastutil.objects.AbstractObjectCollection
it.unimi.dsi.fastutil.objects.AbstractObjectSet
it.unimi.dsi.fastutil.objects.AbstractObjectSortedSet
it.unimi.dsi.fastutil.objects.ObjectAVLTreeSet
A type-specific AVL tree set with a fast, small-footprint implementation.
The iterators provided by this class are type-specific bidirectional iterators.
Moreover, the iterator returned by iterator() can be safely cast
to a type-specific list iterator.
| Field Summary | |
static long |
serialVersionUID
|
| Constructor Summary | |
ObjectAVLTreeSet()
Creates a new empty tree set. |
|
ObjectAVLTreeSet(Collection c)
Creates a new tree set copying a given set. |
|
ObjectAVLTreeSet(Comparator c)
Creates a new empty tree set with the given comparator. |
|
ObjectAVLTreeSet(Iterator i)
Creates a new tree set using elements provided by an iterator. |
|
ObjectAVLTreeSet(Object[] a)
Creates a new tree set copying the elements of an array. |
|
ObjectAVLTreeSet(Object[] a,
Comparator c)
Creates a new tree set copying the elements of an array using a given Comparator. |
|
ObjectAVLTreeSet(Object[] a,
int offset,
int length)
Creates a new tree set and fills it with the elements of a given array. |
|
ObjectAVLTreeSet(Object[] a,
int offset,
int length,
Comparator c)
Creates a new tree set and fills it with the elements of a given array using a given Comparator. |
|
ObjectAVLTreeSet(ObjectCollection c)
Creates a new tree set copying a given type-specific collection. |
|
ObjectAVLTreeSet(ObjectIterator i)
Creates a new tree set using elements provided by a type-specific iterator. |
|
ObjectAVLTreeSet(ObjectSortedSet s)
Creates a new tree set copying a given type-specific sorted set (and its Comparator). |
|
ObjectAVLTreeSet(SortedSet s)
Creates a new tree set copying a given sorted set (and its Comparator). |
|
| Method Summary | |
boolean |
add(Object k)
|
void |
clear()
|
Object |
clone()
Returns a deep copy of this tree set. |
Comparator |
comparator()
|
boolean |
contains(Object k)
|
Object |
first()
Delegates to the corresponding type-specific method. |
SortedSet |
headSet(Object to)
Delegates to the corresponding type-specific method. |
boolean |
isEmpty()
|
ObjectBidirectionalIterator |
iterator(Object from)
Returns a type-specific BidirectionalIterator on the elements in
this set, starting from a given element of the domain (optional operation).
|
Object |
last()
Delegates to the corresponding type-specific method. |
ObjectIterator |
objectIterator()
Returns a type-specific iterator on the collection. |
boolean |
remove(Object k)
Note that the corresponding method of the type-specific collection is rem().
|
int |
size()
|
SortedSet |
subSet(Object from,
Object to)
Delegates to the corresponding type-specific method. |
SortedSet |
tailSet(Object from)
Delegates to the corresponding type-specific method. |
| Methods inherited from class it.unimi.dsi.fastutil.objects.AbstractObjectSet |
equals, hashCode, rem |
| Methods inherited from class it.unimi.dsi.fastutil.objects.AbstractObjectCollection |
addAll, containsAll, iterator, removeAll, retainAll, toArray, toArray, toString |
| Methods inherited from class java.lang.Object |
getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Set |
addAll, containsAll, equals, hashCode, iterator, removeAll, retainAll, toArray, toArray |
| Field Detail |
public static final long serialVersionUID
| Constructor Detail |
public ObjectAVLTreeSet()
public ObjectAVLTreeSet(Comparator c)
c - a Comparator (even better, a type-specific comparator).public ObjectAVLTreeSet(Collection c)
c - a collection to be copied into the new tree set.public ObjectAVLTreeSet(SortedSet s)
Comparator).
s - a SortedSet to be copied into the new tree set.public ObjectAVLTreeSet(ObjectCollection c)
c - a type-specific collection to be copied into the new tree set.public ObjectAVLTreeSet(ObjectSortedSet s)
Comparator).
s - a type-specific sorted set to be copied into the new tree set.public ObjectAVLTreeSet(ObjectIterator i)
i - a type-specific iterator whose elements will fill the set.public ObjectAVLTreeSet(Iterator i)
i - an iterator whose elements will fill the set.
public ObjectAVLTreeSet(Object[] a,
int offset,
int length,
Comparator c)
Comparator.
a - an array whose elements will be used to fill the set.offset - the first element to use.length - the number of elements to use.c - a Comparator (even better, a type-specific comparator).
public ObjectAVLTreeSet(Object[] a,
int offset,
int length)
a - an array whose elements will be used to fill the set.offset - the first element to use.length - the number of elements to use.public ObjectAVLTreeSet(Object[] a)
a - an array to be copied into the new tree set.
public ObjectAVLTreeSet(Object[] a,
Comparator c)
Comparator.
a - an array to be copied into the new tree set.c - a Comparator (even better, a type-specific comparator).| Method Detail |
public final boolean add(Object k)
add in interface Setadd in class AbstractObjectCollectionpublic final boolean remove(Object k)
ObjectSetrem().
This unfortunate situation is caused by the clash
with the similarly named index-based method in the List interface.
remove in interface ObjectSetremove in class AbstractObjectSetpublic boolean contains(Object k)
contains in interface Setpublic void clear()
clear in interface Setclear in class AbstractObjectCollectionpublic int size()
size in interface Setpublic boolean isEmpty()
isEmpty in interface SetisEmpty in class AbstractObjectCollectionpublic Object first()
AbstractObjectSortedSet
first in interface SortedSetfirst in class AbstractObjectSortedSetpublic Object last()
AbstractObjectSortedSet
last in interface SortedSetlast in class AbstractObjectSortedSetpublic ObjectIterator objectIterator()
ObjectCollectionThe iterator returned by the Collection.iterator() method and by this
method are identical; however, using this method you can save a type casting.
objectIterator in interface ObjectCollectionCollection.iterator()public ObjectBidirectionalIterator iterator(Object from)
ObjectSortedSetBidirectionalIterator on the elements in
this set, starting from a given element of the domain (optional operation).
This method returns a type-specific bidirectional iterator with given
starting point. The starting point is any element comparable to the
elements of this set (even if it does not actually belong to the
set). The next element of the returned iterator is the least element of
the set that is greater than the starting point (if there are no
elements greater than the starting point, hasNext() will return
false). The previous element of the returned iterator is
the greatest element of the set that is smaller than or equal to the
starting point (if there are no elements smaller than or equal to the
starting point, hasPrevious() will return false).
Note that passing the last element of the set as starting point and
calling previous() you can traverse the
entire set in reverse order.
iterator in interface ObjectSortedSetiterator in class AbstractObjectSetpublic Comparator comparator()
comparator in interface SortedSetpublic SortedSet headSet(Object to)
AbstractObjectSortedSet
headSet in interface SortedSetheadSet in class AbstractObjectSortedSetpublic SortedSet tailSet(Object from)
AbstractObjectSortedSet
tailSet in interface SortedSettailSet in class AbstractObjectSortedSet
public SortedSet subSet(Object from,
Object to)
AbstractObjectSortedSet
subSet in interface SortedSetsubSet in class AbstractObjectSortedSetpublic Object clone()
This method performs a deep copy of this tree set; the data stored in the set, however, is not cloned. Note that this makes a difference only for object keys.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||