Class ObjectAVLTreeSet<K>
- All Implemented Interfaces:
ObjectBidirectionalIterable<K>,ObjectCollection<K>,ObjectIterable<K>,ObjectSet<K>,ObjectSortedSet<K>,Serializable,Cloneable,Iterable<K>,Collection<K>,SequencedCollection<K>,SequencedSet<K>,Set<K>,SortedSet<K>
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.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new empty tree set.ObjectAVLTreeSet(ObjectCollection<? extends K> c) Creates a new tree set copying a given type-specific collection.Creates a new tree set copying a given type-specific sorted set (and itsComparator).ObjectAVLTreeSet(Collection<? extends K> c) Creates a new tree set copying a given set.ObjectAVLTreeSet(Comparator<? super K> c) Creates a new empty tree set with the given comparator.ObjectAVLTreeSet(Iterator<? extends K> i) Creates a new tree set using elements provided by a type-specific iterator.Creates a new tree set copying a given sorted set (and itsComparator).ObjectAVLTreeSet(K[] a) Creates a new tree set copying the elements of an array.ObjectAVLTreeSet(K[] a, int offset, int length) Creates a new tree set and fills it with the elements of a given array.ObjectAVLTreeSet(K[] a, int offset, int length, Comparator<? super K> c) Creates a new tree set and fills it with the elements of a given array using a givenComparator.ObjectAVLTreeSet(K[] a, Comparator<? super K> c) Creates a new tree set copying the elements of an array using a givenComparator. -
Method Summary
Modifier and TypeMethodDescriptionbooleanvoidclear()clone()Returns a deep copy of this tree set.Comparator<? super K> booleanfirst()Returns a view of the portion of this sorted set whose elements are strictly less thantoElement.booleanisEmpty()iterator()Returns a type-specific iterator on the elements of this collection.Returns a type-specificBidirectionalIteratoron the elements in this set, starting from a given element of the domain (optional operation).last()booleanintsize()Returns a view of the portion of this sorted set whose elements range fromfromElement, inclusive, totoElement, exclusive.Returns a view of the portion of this sorted set whose elements are greater than or equal tofromElement.Methods inherited from class it.unimi.dsi.fastutil.objects.AbstractObjectSet
equals, hashCodeMethods inherited from class it.unimi.dsi.fastutil.objects.AbstractObjectCollection
toStringMethods inherited from class java.util.AbstractCollection
addAll, containsAll, removeAll, retainAll, toArray, toArrayMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface it.unimi.dsi.fastutil.objects.ObjectSortedSet
spliteratorMethods inherited from interface java.util.Set
addAll, containsAll, equals, hashCode, removeAll, retainAll, toArray, toArrayMethods inherited from interface java.util.SortedSet
addFirst, addLast, getFirst, getLast, removeFirst, removeLast, reversed
-
Constructor Details
-
ObjectAVLTreeSet
public ObjectAVLTreeSet()Creates a new empty tree set. -
ObjectAVLTreeSet
Creates a new empty tree set with the given comparator.- Parameters:
c- aComparator(even better, a type-specific comparator).
-
ObjectAVLTreeSet
Creates a new tree set copying a given set.- Parameters:
c- a collection to be copied into the new tree set.
-
ObjectAVLTreeSet
Creates a new tree set copying a given sorted set (and itsComparator).- Parameters:
s- aSortedSetto be copied into the new tree set.
-
ObjectAVLTreeSet
Creates a new tree set copying a given type-specific collection.- Parameters:
c- a type-specific collection to be copied into the new tree set.
-
ObjectAVLTreeSet
Creates a new tree set copying a given type-specific sorted set (and itsComparator).- Parameters:
s- a type-specific sorted set to be copied into the new tree set.
-
ObjectAVLTreeSet
Creates a new tree set using elements provided by a type-specific iterator.- Parameters:
i- a type-specific iterator whose elements will fill the set.
-
ObjectAVLTreeSet
Creates a new tree set and fills it with the elements of a given array using a givenComparator.- Parameters:
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- aComparator(even better, a type-specific comparator).
-
ObjectAVLTreeSet
Creates a new tree set and fills it with the elements of a given array.- Parameters:
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.
-
ObjectAVLTreeSet
Creates a new tree set copying the elements of an array.- Parameters:
a- an array to be copied into the new tree set.
-
ObjectAVLTreeSet
Creates a new tree set copying the elements of an array using a givenComparator.- Parameters:
a- an array to be copied into the new tree set.c- aComparator(even better, a type-specific comparator).
-
-
Method Details
-
add
- Specified by:
addin interfaceCollection<K>- Specified by:
addin interfaceSet<K>- Overrides:
addin classAbstractCollection<K>
-
remove
- Specified by:
removein interfaceCollection<K>- Specified by:
removein interfaceSet<K>- Overrides:
removein classAbstractCollection<K>
-
contains
- Specified by:
containsin interfaceCollection<K>- Specified by:
containsin interfaceSet<K>- Overrides:
containsin classAbstractCollection<K>
-
get
-
clear
public void clear()- Specified by:
clearin interfaceCollection<K>- Specified by:
clearin interfaceSet<K>- Overrides:
clearin classAbstractCollection<K>
-
size
public int size()- Specified by:
sizein interfaceCollection<K>- Specified by:
sizein interfaceSet<K>- Specified by:
sizein classAbstractCollection<K>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceCollection<K>- Specified by:
isEmptyin interfaceSet<K>- Overrides:
isEmptyin classAbstractCollection<K>
-
first
-
last
-
iterator
Description copied from interface:ObjectCollectionReturns a type-specific iterator on the elements of this collection.- Specified by:
iteratorin interfaceCollection<K>- Specified by:
iteratorin interfaceIterable<K>- Specified by:
iteratorin interfaceObjectBidirectionalIterable<K>- Specified by:
iteratorin interfaceObjectCollection<K>- Specified by:
iteratorin interfaceObjectIterable<K>- Specified by:
iteratorin interfaceObjectSet<K>- Specified by:
iteratorin interfaceObjectSortedSet<K>- Specified by:
iteratorin interfaceSet<K>- Specified by:
iteratorin classAbstractObjectSortedSet<K>- Returns:
- a type-specific iterator on the elements of this collection.
- See Also:
-
iterator
Description copied from interface:ObjectSortedSetReturns a type-specificBidirectionalIteratoron 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 returnfalse). 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 returnfalse).Note that passing the last element of the set as starting point and calling
previous()you can traverse the entire set in reverse order.- Specified by:
iteratorin interfaceObjectSortedSet<K>- Parameters:
from- an element to start from.- Returns:
- a bidirectional iterator on the element in this set, starting at the given element.
-
comparator
- Specified by:
comparatorin interfaceSortedSet<K>
-
headSet
Description copied from interface:ObjectSortedSetReturns a view of the portion of this sorted set whose elements are strictly less thantoElement. -
tailSet
Description copied from interface:ObjectSortedSetReturns a view of the portion of this sorted set whose elements are greater than or equal tofromElement. -
subSet
Description copied from interface:ObjectSortedSetReturns a view of the portion of this sorted set whose elements range fromfromElement, inclusive, totoElement, exclusive. -
clone
Returns a deep copy of this tree set.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.
- Returns:
- a deep copy of this tree set.
-