Class AbstractIntSet
- java.lang.Object
-
- java.util.AbstractCollection<Integer>
-
- it.unimi.dsi.fastutil.ints.AbstractIntCollection
-
- it.unimi.dsi.fastutil.ints.AbstractIntSet
-
- All Implemented Interfaces:
IntCollection,IntIterable,IntSet,Cloneable,Iterable<Integer>,Collection<Integer>,Set<Integer>
- Direct Known Subclasses:
AbstractIntSortedSet,IntArraySet,IntOpenCustomHashSet,IntOpenHashBigSet,IntOpenHashSet,IntSets.Singleton
public abstract class AbstractIntSet extends AbstractIntCollection implements Cloneable, IntSet
An abstract class providing basic methods for sets implementing a type-specific interface.Note that the type-specific
Setinterface adds a type-specificremove()method, as it is no longer harmful for subclasses. Thus, concrete subclasses of this class must implementremove()(therem()implementation of this class just delegates toremove()).
-
-
Method Summary
Modifier and Type Method Description booleanequals(Object o)inthashCode()Returns a hash code for this set.abstract IntIteratoriterator()Returns a type-specific iterator on the elements of this collection.booleanrem(int k)Deprecated.Please useremove()instead.booleanremove(int k)Removes an element from this set.-
Methods inherited from class it.unimi.dsi.fastutil.ints.AbstractIntCollection
add, add, addAll, contains, contains, containsAll, remove, removeAll, retainAll, toArray, toIntArray, toIntArray, toString
-
Methods inherited from class java.util.AbstractCollection
addAll, clear, containsAll, isEmpty, removeAll, retainAll, size, toArray, toArray
-
Methods inherited from interface java.util.Collection
parallelStream, stream, toArray
-
Methods inherited from interface it.unimi.dsi.fastutil.ints.IntCollection
add, addAll, contains, containsAll, removeAll, removeIf, removeIf, retainAll, toArray, toIntArray, toIntArray
-
Methods inherited from interface it.unimi.dsi.fastutil.ints.IntIterable
forEach, forEach
-
-
-
-
Method Detail
-
iterator
public abstract IntIterator iterator()
Description copied from interface:IntCollectionReturns a type-specific iterator on the elements of this collection.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 extendsCollection.- Specified by:
iteratorin interfaceCollection<Integer>- Specified by:
iteratorin interfaceIntCollection- Specified by:
iteratorin interfaceIntIterable- Specified by:
iteratorin interfaceIntSet- Specified by:
iteratorin interfaceIterable<Integer>- Specified by:
iteratorin interfaceSet<Integer>- Specified by:
iteratorin classAbstractIntCollection- Returns:
- a type-specific iterator on the elements of this collection.
- See Also:
Iterable.iterator()
-
equals
public boolean equals(Object o)
-
hashCode
public int hashCode()
Returns a hash code for this set. The hash code of a set is computed by summing the hash codes of its elements.
-
remove
public boolean remove(int k)
Removes an element from this set.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 theListinterface. Delegates to the type-specificrem()method implemented by type-specific abstractCollectionsuperclass.- Specified by:
removein interfaceIntSet- See Also:
Collection.remove(Object)
-
rem
@Deprecated public boolean rem(int k)
Deprecated.Please useremove()instead.Removes a single instance of the specified element from this collection, if it is present (optional operation).Note that this method should be called
remove(), but the clash with the similarly named index-based method in theListinterface forces us to use a distinguished name. For simplicity, the set interfaces reinstatesremove().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-specificSetinterface.- Specified by:
remin interfaceIntCollection- Specified by:
remin interfaceIntSet- Overrides:
remin classAbstractIntCollection- See Also:
Collection.remove(Object)
-
-