/** * Remove all values in the array set that exist in the given collection. * @param collection The collection whose contents are to be used to remove values. * @return Returns true if any values were removed from the array set, else false. */ @Override public boolean removeAll(Collection<?> collection) { boolean removed = false; for (Object value : collection) { removed |= remove(value); } return removed; }
/** * Perform a {@link #remove(Object)} of all values in <var>array</var> * @param array The array whose contents are to be removed. */ public boolean removeAll(ArraySet<? extends E> array) { // TODO: If array is sufficiently large, a marking approach might be beneficial. In a first // pass, use the property that the sets are sorted by hash to make this linear passes // (except for hash collisions, which means worst case still n*m), then do one // collection pass into a new array. This avoids binary searches and excessive memcpy. final int N = array.mSize; // Note: ArraySet does not make thread-safety guarantees. So instead of OR-ing together all // the single results, compare size before and after. final int originalSize = mSize; for (int i = 0; i < N; i++) { remove(array.valueAt(i)); } return originalSize != mSize; }
/** * Remove all values in the array set that exist in the given collection. * @param collection The collection whose contents are to be used to remove values. * @return Returns true if any values were removed from the array set, else false. */ @Override public boolean removeAll(Collection<?> collection) { boolean removed = false; for (Object value : collection) { removed |= remove(value); } return removed; }
/** * Remove all values in the array set that exist in the given collection. * @param collection The collection whose contents are to be used to remove values. * @return Returns true if any values were removed from the array set, else false. */ @Override public boolean removeAll(Collection<?> collection) { boolean removed = false; for (Object value : collection) { removed |= remove(value); } return removed; }
/** * Perform a {@link #remove(Object)} of all values in <var>array</var> * @param array The array whose contents are to be removed. */ public boolean removeAll(ArraySet<? extends E> array) { // TODO: If array is sufficiently large, a marking approach might be beneficial. In a first // pass, use the property that the sets are sorted by hash to make this linear passes // (except for hash collisions, which means worst case still n*m), then do one // collection pass into a new array. This avoids binary searches and excessive memcpy. final int N = array.mSize; // Note: ArraySet does not make thread-safety guarantees. So instead of OR-ing together all // the single results, compare size before and after. final int originalSize = mSize; for (int i = 0; i < N; i++) { remove(array.valueAt(i)); } return originalSize != mSize; }
/** * Perform a {@link #remove(Object)} of all values in <var>array</var> * @param array The array whose contents are to be removed. */ public boolean removeAll(ArraySet<? extends E> array) { // TODO: If array is sufficiently large, a marking approach might be beneficial. In a first // pass, use the property that the sets are sorted by hash to make this linear passes // (except for hash collisions, which means worst case still n*m), then do one // collection pass into a new array. This avoids binary searches and excessive memcpy. final int N = array.mSize; // Note: ArraySet does not make thread-safety guarantees. So instead of OR-ing together all // the single results, compare size before and after. final int originalSize = mSize; for (int i = 0; i < N; i++) { remove(array.valueAt(i)); } return originalSize != mSize; }