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.
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 |