/** * Remove from this collection all of its elements except those that are * contained in the specified collection. * * @param collection Collection containing elements to be retained * * @exception UnsupportedOperationException if this optional operation * is not supported by this list */ public override bool retainAll(java.util.Collection <Object> collection) { if (fast) { lock (this) { java.util.ArrayList <Object> temp = (java.util.ArrayList <Object>)list.clone(); bool result = temp.retainAll(collection); list = temp; return(result); } } else { lock (list) { return(list.retainAll(collection)); } } }