/** * {@inheritDoc} * * <p>This implementation iterates over the elements of this list, checking each element in turn * to see if it's contained in <code>coll</code>. If it's not contained, it's removed from this * list. As a consequence, it is advised to use a collection type for <code>coll</code> that * provides a fast (e.g. O(1)) implementation of {@link Collection#contains(Object)}. */ @Override public boolean retainAll(final Collection<?> coll) { boolean result = set.retainAll(coll); if (result == false) { return false; } if (set.size() == 0) { super.clear(); } else { // use the set as parameter for the call to retainAll to improve performance super.retainAll(set); } return result; }
public void clear() { super.clear(); set.clear(); }
@Override public void clear() { super.clear(); set.clear(); }