IntCollection
, IntIterable
, IntSet
, java.lang.Cloneable
, java.lang.Iterable<java.lang.Integer>
, java.util.Collection<java.lang.Integer>
, java.util.Set<java.lang.Integer>
AbstractIntSortedSet
, IntArraySet
, IntOpenCustomHashSet
, IntOpenHashBigSet
, IntOpenHashSet
, IntSets.Singleton
public abstract class AbstractIntSet extends AbstractIntCollection implements java.lang.Cloneable, IntSet
Note that the type-specific Set
interface adds a type-specific
remove()
method, as it is no longer harmful for subclasses. Thus,
concrete subclasses of this class must implement remove()
(the
rem()
implementation of this class just delegates to
remove()
).
Modifier and Type | Method | Description |
---|---|---|
boolean |
equals(java.lang.Object o) |
|
int |
hashCode() |
Returns a hash code for this set.
|
abstract IntIterator |
iterator() |
Returns a type-specific iterator on the elements of this collection.
|
boolean |
rem(int k) |
Deprecated.
Please use
remove() instead. |
boolean |
remove(int k) |
Removes an element from this set.
|
addAll, clear, containsAll, isEmpty, removeAll, retainAll, size, toArray, toArray
add, add, addAll, contains, contains, containsAll, remove, removeAll, retainAll, toArray, toIntArray, toIntArray, toString
add, addAll, contains, containsAll, removeAll, removeIf, removeIf, retainAll, toArray, toIntArray, toIntArray
forEach, forEach
public abstract IntIterator iterator()
IntCollection
Note that this specification strengthens the one given in
Iterable.iterator()
, which was already strengthened in the
corresponding type-specific class, but was weakened by the fact that this
interface extends Collection
.
iterator
in interface java.util.Collection<java.lang.Integer>
iterator
in interface IntCollection
iterator
in interface IntIterable
iterator
in interface IntSet
iterator
in interface java.lang.Iterable<java.lang.Integer>
iterator
in interface java.util.Set<java.lang.Integer>
iterator
in class AbstractIntCollection
Iterable.iterator()
public boolean equals(java.lang.Object o)
equals
in interface java.util.Collection<java.lang.Integer>
equals
in interface java.util.Set<java.lang.Integer>
equals
in class java.lang.Object
public int hashCode()
hashCode
in interface java.util.Collection<java.lang.Integer>
hashCode
in interface java.util.Set<java.lang.Integer>
hashCode
in class java.lang.Object
public boolean remove(int k)
Note that the corresponding method of a type-specific collection is
rem()
. This unfortunate situation is caused by the clash with the
similarly named index-based method in the List
interface. Delegates to the type-specific rem()
method implemented
by type-specific abstract Collection
superclass.
@Deprecated public boolean rem(int k)
remove()
instead.
Note that this method should be called
remove()
, but the clash with the
similarly named index-based method in the List
interface
forces us to use a distinguished name. For simplicity, the set interfaces
reinstates remove()
.
This implementation iterates over the elements in the collection, looking for
the specified element and tries to remove it. Delegates to the type-specific remove()
method
specified in the type-specific Set
interface.
rem
in interface IntCollection
rem
in interface IntSet
rem
in class AbstractIntCollection
Collection.remove(Object)