public boolean removeAll(Collection<?> c){
  if (c == null)   throw new NullPointerException();
  final ReentrantLock lock=this.lock;
  lock.lock();
  try {
    Object[] elements=getArray();
    int len=elements.length;
    if (len != 0) {
      int newlen=0;
      Object[] temp=new Object[len];
      for (int i=0; i < len; ++i) {
        Object element=elements[i];
        if (!c.contains(element))         temp[newlen++]=element;
      }
      if (newlen != len) {
        setArray(Arrays.copyOf(temp,newlen));
        return true;
      }
    }
    return false;
  }
  finally {
    lock.unlock();
  }
}

public boolean removeAll ( Collection < ? > c ) { if ( c == null ) throw new NullPointerException ( ) ; final ReentrantLock lock = this . lock ; lock . lock ( ) ; try { Object [ ] elements = getArray ( ) ; int len = elements . length ; if ( len != 0 ) { int newlen = 0 ; Object [ ] temp = new Object [ len ] ; for ( int i = 0 ; i < len ; ++ i ) { Object element = elements [ i ] ; if ( ! c . contains ( element ) ) temp [ newlen ++ ] = element ; } if ( newlen != len ) { setArray ( Arrays . copyOf ( temp , newlen ) ) ; return true ; } } return false ; } finally { lock . unlock ( ) ; } }
removes from this list all of its elements that are contained in the specified collection . this is a particularly expensive operation in this class because of the need for an internal temporary array .
