public boolean removeAll(TArray<? extends T> array, boolean identity) { if (array.size == 0) { return true; } int size = this.size; int startSize = size; T[] items = this.items; if (identity) { for (int i = 0, n = array.size; i < n; i++) { T item = array.get(i); for (int ii = 0; ii < size; ii++) { if (item == items[ii]) { removeIndex(ii); size--; break; } } } } else { for (int i = 0, n = array.size; i < n; i++) { T item = array.get(i); for (int ii = 0; ii < size; ii++) { if (item.equals(items[ii])) { removeIndex(ii); size--; break; } } } } return size != startSize; }
@Override public void remove() { if (!allowRemove) { throw new RuntimeException("Remove not allowed."); } index--; array.removeIndex(index); }
public boolean remove(T value, boolean identity) { Object[] items = this.items; if (identity || value == null) { for (int i = 0; i < size; i++) { if (items[i] == value) { removeIndex(i); return true; } } } else { for (int i = 0; i < size; i++) { if (value.equals(items[i])) { removeIndex(i); return true; } } } return false; }
public boolean removeValue(T value) { T[] items = this.items; for (int i = 0, n = size; i < n; i++) { if (items[i] == value || value.equals(items[i])) { removeIndex(i); return true; } } return false; }