Skip to content

Most visited

Recently visited

navigation
Added in API level 1

AbstractSet

public abstract class AbstractSet
extends AbstractCollection<E> implements Set<E>

java.lang.Object
   ↳ java.util.AbstractCollection<E>
     ↳ java.util.AbstractSet<E>
Known Direct Subclasses
Known Indirect Subclasses


An AbstractSet is an abstract implementation of the Set interface. This implementation does not support adding. A subclass must implement the abstract methods iterator() and size().

Summary

Protected constructors

AbstractSet()

Constructs a new instance of this AbstractSet.

Public methods

boolean equals(Object object)

Compares the specified object to this Set and returns true if they are equal.

int hashCode()

Returns the hash code for this set.

boolean removeAll(Collection<?> collection)

Removes all occurrences in this collection which are contained in the specified collection.

Inherited methods

From class java.util.AbstractCollection
From class java.lang.Object
From interface java.util.Collection
From interface java.util.Set
From interface java.lang.Iterable

Protected constructors

AbstractSet

Added in API level 1
AbstractSet ()

Constructs a new instance of this AbstractSet.

Public methods

equals

Added in API level 1
boolean equals (Object object)

Compares the specified object to this Set and returns true if they are equal. The object must be an instance of Set and contain the same objects.

Parameters
object Object: the object to compare with this set.
Returns
boolean true if the specified object is equal to this set, false otherwise

See also:

hashCode

Added in API level 1
int hashCode ()

Returns the hash code for this set. Two set which are equal must return the same value. This implementation calculates the hash code by adding each element's hash code.

Returns
int the hash code of this set.

See also:

removeAll

Added in API level 1
boolean removeAll (Collection<?> collection)

Removes all occurrences in this collection which are contained in the specified collection.

Parameters
collection Collection: the collection of objects to remove.
Returns
boolean true if this collection was modified, false otherwise.
Throws
UnsupportedOperationException if removing from this collection is not supported.
This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.