to top
Android APIs
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

Class Overview

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.
[Expand]
Inherited Methods
From class java.util.AbstractCollection
From class java.lang.Object
From interface java.lang.Iterable
From interface java.util.Collection
From interface java.util.Set

Protected Constructors

protected AbstractSet ()

Since: API Level 1

Constructs a new instance of this AbstractSet.

Public Methods

public boolean equals (Object object)

Since: API Level 1

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 the object to compare with this set.
Returns
  • true if the specified object is equal to this set, false otherwise
See Also

public int hashCode ()

Since: API Level 1

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
  • the hash code of this set.
See Also

public boolean removeAll (Collection<?> collection)

Since: API Level 1

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

Parameters
collection the collection of objects to remove.
Returns
  • true if this collection was modified, false otherwise.
Throws
UnsupportedOperationException if removing from this collection is not supported.