Name

AbstractSet<E>

Synopsis

This abstract class is a partial implementation of the Set interface that makes it easy to create custom Set implementations. Since Set defines the same methods as Collection, you can subclass AbstractSet exactly as you would subclass AbstractCollection. See AbstractCollection for details. Note, however, that when subclassing AbstractSet, you should be sure that your add( ) method and your constructors do not allow duplicate elements to be added to the set. See also AbstractList.

java.util.AbstractSet<E>

Figure 16-6. java.util.AbstractSet<E>

public abstract class AbstractSet<E> extends AbstractCollection<E> implements Set<E> {
// Protected Constructors
     protected AbstractSet( );  
// Methods Implementing Set
     public boolean equals(Object o);  
     public int hashCode( );  
1.3  public boolean removeAll(Collection<?> c);  
}

Subclasses

EnumSet, HashSet, TreeSet, java.util.concurrent.CopyOnWriteArraySet

Get Java in a Nutshell, 5th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.