public class ArraySet extends AbstractIntSet
IntSet-based class internally managed by a sorted array of
ints.IntSet.IntIterator| Constructor and Description |
|---|
ArraySet()
Empty-set constructor
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(int element)
Adds the specified element to this set if it is not already present.
|
boolean |
addAll(IntSet c)
Adds all of the elements in the specified collection to this set if
they're not already present.
|
double |
bitmapCompressionRatio()
|
void |
clear()
Removes all of the elements from this set.
|
void |
clear(int from,
int to)
Removes from the set all the elements between
first and
last, both included. |
ArraySet |
clone()
See the
clone() of Object |
double |
collectionCompressionRatio()
|
void |
complement()
Complements the current set.
|
ArraySet |
complemented()
Generates the complement set.
|
boolean |
contains(int element)
Returns true if this set contains the specified element.
|
boolean |
containsAll(IntSet c)
Returns true if this set contains all of the elements of the
specified collection.
|
boolean |
containsAny(IntSet other)
|
boolean |
containsAtLeast(IntSet other,
int minElements)
|
ArraySet |
convert(Collection<Integer> c)
Converts a given collection into an instance of the current class.
|
ArraySet |
convert(int... a)
Converts a given array into an instance of the current class.
|
String |
debugInfo()
Prints debug info about the given
IntSet implementation |
IntSet.IntIterator |
descendingIterator() |
ArraySet |
difference(IntSet other)
Generates the difference set
|
ArraySet |
empty()
Generates an empty set
|
boolean |
equals(Object obj) |
void |
fill(int from,
int to)
Adds to the set all the elements between
first and
last, both included. |
int |
first()
Returns the first (lowest) element currently in this set.
|
void |
flip(int element)
Adds the element if it not existing, or removes it if existing
|
int |
get(int i)
Gets the
ith element of the set |
int |
hashCode() |
int |
indexOf(int e)
Provides position of element within the set.
|
ArraySet |
intersection(IntSet other)
Generates the intersection set
|
int |
intersectionSize(IntSet other)
Computes the intersection set size.
|
boolean |
isEmpty() |
IntSet.IntIterator |
iterator() |
int |
last()
Returns the last (highest) element currently in this set.
|
boolean |
remove(int element)
Removes the specified element from this set if it is present.
|
boolean |
removeAll(IntSet c)
Removes from this set all of its elements that are contained in the
specified collection.
|
boolean |
retainAll(IntSet c)
Retains only the elements in this set that are contained in the specified
collection.
|
int |
size() |
ArraySet |
symmetricDifference(IntSet other)
Generates the symmetric difference set
|
ArraySet |
union(IntSet other)
Generates the union set
|
compareTo, complementSize, differenceSize, jaccardDistance, jaccardSimilarity, powerSet, powerSet, powerSetSize, powerSetSize, symmetricDifferenceSize, toArray, toArray, toString, unionSize, weightedJaccardDistance, weightedJaccardSimilaritypublic double bitmapCompressionRatio()
BitSet, 2 means twice the size of BitSet, etc.)bitmapCompressionRatio in interface IntSetbitmapCompressionRatio in class AbstractIntSetpublic double collectionCompressionRatio()
ArrayList, 2 means twice the size of ArrayList, etc.)collectionCompressionRatio in interface IntSetcollectionCompressionRatio in class AbstractIntSetpublic ArraySet empty()
empty in interface IntSetempty in class AbstractIntSetpublic IntSet.IntIterator iterator()
iterator in interface IntSetiterator in class AbstractIntSetIntSet.IntIterator instance to iterate over the setpublic IntSet.IntIterator descendingIterator()
descendingIterator in interface IntSetdescendingIterator in class AbstractIntSetIntSet.IntIterator instance to iterate over the set in
descending orderpublic ArraySet clone()
clone() of Objectclone in interface IntSetclone in class AbstractIntSetpublic String debugInfo()
IntSet implementationdebugInfo in interface IntSetdebugInfo in class AbstractIntSetpublic boolean add(int element)
add in interface IntSetadd in class AbstractIntSetelement - element to be added to this setpublic boolean remove(int element)
remove in interface IntSetremove in class AbstractIntSetelement - object to be removed from this set, if presentpublic void flip(int element)
flip in interface IntSetflip in class AbstractIntSetelement - element to flipIntSet.symmetricDifference(IntSet)public boolean contains(int element)
contains in interface IntSetcontains in class AbstractIntSetelement - element whose presence in this set is to be testedpublic boolean containsAll(IntSet c)
containsAll in interface IntSetcontainsAll in class AbstractIntSetc - collection to be checked for containment in this setIntSet.contains(int)public boolean containsAny(IntSet other)
true if the specified IntSet
instance contains any elements that are also contained within this
IntSet instancecontainsAny in interface IntSetcontainsAny in class AbstractIntSetother - IntSet to intersect withIntSet
intersects the specified IntSet.public boolean containsAtLeast(IntSet other, int minElements)
true if the specified IntSet
instance contains at least minElements elements that are
also contained within this IntSet instancecontainsAtLeast in interface IntSetcontainsAtLeast in class AbstractIntSetother - IntSet instance to intersect withminElements - minimum number of elements to be contained within this
IntSet instanceIntSet
intersects the specified IntSet.public boolean addAll(IntSet c)
addAll in interface IntSetaddAll in class AbstractIntSetc - collection containing elements to be added to this setIntSet.add(int)public boolean retainAll(IntSet c)
retainAll in interface IntSetretainAll in class AbstractIntSetc - collection containing elements to be retained in this setIntSet.remove(int)public boolean removeAll(IntSet c)
removeAll in interface IntSetremoveAll in class AbstractIntSetc - collection containing elements to be removed from this setIntSet.remove(int),
IntSet.contains(int)public int hashCode()
hashCode in class AbstractIntSetpublic boolean equals(Object obj)
equals in class AbstractIntSetpublic int size()
size in interface IntSetsize in class AbstractIntSetpublic boolean isEmpty()
isEmpty in interface IntSetisEmpty in class AbstractIntSetpublic void clear()
clear in interface IntSetclear in class AbstractIntSetpublic int first()
first in interface IntSetfirst in class AbstractIntSetpublic int last()
last in interface IntSetlast in class AbstractIntSetpublic int intersectionSize(IntSet other)
This is faster than calling IntSet.intersection(IntSet) and
then IntSet.size()
intersectionSize in interface IntSetintersectionSize in class AbstractIntSetother - IntSet instance that represents the right
operandpublic ArraySet intersection(IntSet other)
intersection in interface IntSetintersection in class AbstractIntSetother - IntSet instance that represents the right
operandIntSet.retainAll(IntSet)public ArraySet union(IntSet other)
union in interface IntSetunion in class AbstractIntSetother - IntSet instance that represents the right
operandIntSet.addAll(IntSet)public ArraySet difference(IntSet other)
difference in interface IntSetdifference in class AbstractIntSetother - IntSet instance that represents the right
operandIntSet.removeAll(IntSet)public ArraySet symmetricDifference(IntSet other)
symmetricDifference in interface IntSetsymmetricDifference in class AbstractIntSetother - IntSet instance that represents the right
operandIntSet.flip(int)public void complement()
IntSet.last() that do not exist in the
current set.complement in interface IntSetcomplement in class AbstractIntSetIntSet.complemented()public void fill(int from,
int to)
first and
last, both included.fill in interface IntSetfill in class AbstractIntSetfrom - first elementto - last elementpublic void clear(int from,
int to)
first and
last, both included.clear in interface IntSetclear in class AbstractIntSetfrom - first elementto - last elementpublic ArraySet convert(int... a)
convert in interface IntSetconvert in class AbstractIntSeta - array to use to generate the new instancepublic ArraySet convert(Collection<Integer> c)
convert in interface IntSetconvert in class AbstractIntSetc - array to use to generate the new instancepublic ArraySet complemented()
IntSet.last() that do not exist in the
current set.complemented in interface IntSetcomplemented in class AbstractIntSetIntSet.complement()public int get(int i)
ith element of the setget in interface IntSetget in class AbstractIntSeti - position of the element in the sorted setith element of the setpublic int indexOf(int e)
It returns -1 if the element does not exist within the set.
indexOf in interface IntSetindexOf in class AbstractIntSete - element of the setCopyright © 2016. All rights reserved.