|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface IntSet
An ordered set of integers.
ints: set int |
Method Summary | |
---|---|
boolean |
add(int i)
Adds the given integer to this set if not already present and returns true. |
boolean |
addAll(IntCollection c)
Adds all of the elements in the specified collection to this set if they're not already present. |
int |
ceil(int i)
Returns the smallest element in this set that is greater than or equal to i. |
void |
clear()
Removes all elements from this set. |
IntSet |
clone()
Returns a copy of this IntSet. |
boolean |
contains(int i)
Returns true if i is in this set. |
boolean |
containsAll(IntCollection c)
Returns true if the elements of c are a subset of this set. |
boolean |
equals(java.lang.Object o)
Compares the specified object with this set for equality. |
int |
floor(int i)
Returns the largest element in this set that is smaller than or equal to i. |
int |
hashCode()
Returns the hash code value for this set. |
boolean |
isEmpty()
Returns true if this set has no elements; otherwise returns false. |
IntIterator |
iterator()
Returns an iterator over the integers in this set, in the ascending element order. |
IntIterator |
iterator(int from,
int to)
Returns an iterator over the elements of this set that are in the closed range [from..to]. |
int |
max()
Returns the largest element in this set. |
int |
min()
Returns the smallest element in this set. |
boolean |
remove(int i)
Removes the given integer from this set if already present and returns true. |
boolean |
removeAll(IntCollection c)
Removes from this set all of its elements that are contained in the specified set. |
boolean |
retainAll(IntCollection c)
Retains only the elements in this set that are contained in the specified set. |
int |
size()
Returns the cardinality of this set. |
int[] |
toArray()
Returns an array containing all of the elements in this set in the ascending order. |
int[] |
toArray(int[] array)
Copies the elements of this set into the specified array, in the ascending order, provided that the array is large enough. |
Method Detail |
---|
int size()
size
in interface IntCollection
boolean isEmpty()
isEmpty
in interface IntCollection
boolean contains(int i)
contains
in interface IntCollection
int min()
java.util.NoSuchElementException
- - no this.intsint max()
java.util.NoSuchElementException
- - no this.intsint floor(int i)
java.util.NoSuchElementException
- - no this.ints || i < this.min()int ceil(int i)
java.util.NoSuchElementException
- - no this.ints || i > this.max()IntIterator iterator()
iterator
in interface IntCollection
IntIterator iterator(int from, int to)
boolean add(int i)
add
in interface IntCollection
java.lang.IllegalArgumentException
- - this is a bounded set
and i is out of boundsthis.ints' = this.ints + i |
boolean remove(int i)
remove
in interface IntCollection
this.ints' = this.ints - i |
boolean containsAll(IntCollection c)
containsAll
in interface IntCollection
java.lang.NullPointerException
- - c = nullboolean addAll(IntCollection c)
addAll
in interface IntCollection
java.lang.NullPointerException
- - c = null
java.lang.UnsupportedOperationException
- - this is an unmodifiable set
java.lang.IllegalArgumentException
- - some aspect of an element of the specified
collection prevents it from being added to this collection.this.ints' = this.ints + { i: int | c.contains(i) } |
boolean removeAll(IntCollection c)
removeAll
in interface IntCollection
java.lang.NullPointerException
- - s = null
java.lang.UnsupportedOperationException
- - this is an unmodifiable setthis.ints' = this.ints - { i: int | c.contains(i) } |
boolean retainAll(IntCollection c)
retainAll
in interface IntCollection
java.lang.NullPointerException
- - s = null
java.lang.UnsupportedOperationException
- - this is an unmodifiable setthis.ints' = this.ints & { i: int | c.contains(i) } |
void clear()
clear
in interface IntCollection
no this.ints' |
IntSet clone() throws java.lang.CloneNotSupportedException
java.lang.CloneNotSupportedException
- - this is not cloneableint[] toArray()
toArray
in interface IntCollection
int[] toArray(int[] array)
toArray
in interface IntCollection
java.lang.NullPointerException
- - array = nullarray.length>=this.size() => all i: [0..this.size()) | array'[i] in this.ints and #{e: this.ints | e < array'[i]} = i |
boolean equals(java.lang.Object o)
equals
in class java.lang.Object
int hashCode()
Ints.superFastHash(int[])
of the elements in the set,
taken in the ascending order of values.
This ensures that s1.equals(s2) implies that s1.hashCode()==s2.hashCode()
for any two IntSets s1 and s2, as required by the general contract of the Object.hashCode method.
hashCode
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |