/** * Removes any values in the set which are not contained in * <tt>collection</tt>. * * @param collection a <code>Collection</code> value * @return true if the set was modified by the retain all operation */ @SuppressWarnings({"SuspiciousMethodCalls"}) public boolean retainAll( Collection<?> collection ) { boolean changed = false; int size = size(); Iterator<E> it = iterator(); while ( size-- > 0 ) { if ( !collection.contains( it.next() ) ) { it.remove(); changed = true; } } return changed; }
/** * Removes any values in the set which are not contained in * <tt>collection</tt>. * * @param collection a <code>Collection</code> value * @return true if the set was modified by the retain all operation */ @SuppressWarnings({"SuspiciousMethodCalls"}) public boolean retainAll( Collection<?> collection ) { boolean changed = false; int size = size(); Iterator<E> it = iterator(); while ( size-- > 0 ) { if ( !collection.contains( it.next() ) ) { it.remove(); changed = true; } } return changed; }
/** * Removes any values in the set which are not contained in * <tt>collection</tt>. * * @param collection a <code>Collection</code> value * @return true if the set was modified by the retain all operation */ @SuppressWarnings({"SuspiciousMethodCalls"}) public boolean retainAll( Collection<?> collection ) { boolean changed = false; int size = size(); Iterator<E> it = iterator(); while ( size-- > 0 ) { if ( !collection.contains( it.next() ) ) { it.remove(); changed = true; } } return changed; }
/** * Removes any values in the set which are not contained in * <tt>collection</tt>. * * @param collection a <code>Collection</code> value * @return true if the set was modified by the retain all operation */ @Override public boolean retainAll( Collection<?> collection ) { boolean changed = false; int size = size(); Iterator<E> it = iterator(); while ( size-- > 0 ) { if ( !collection.contains( it.next() ) ) { it.remove(); changed = true; } } return changed; }
/** * Removes any values in the set which are not contained in * <tt>collection</tt>. * * @param collection a <code>Collection</code> value * @return true if the set was modified by the retain all operation */ @SuppressWarnings({"SuspiciousMethodCalls"}) public boolean retainAll( Collection<?> collection ) { boolean changed = false; int size = size(); Iterator<E> it = iterator(); while ( size-- > 0 ) { if ( !collection.contains( it.next() ) ) { it.remove(); changed = true; } } return changed; }