We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
In the removeIf of primitive types, the template zeroes the remaining of the list. Is it really necessary to do so?
@Override public boolean removeIf(<name>Predicate predicate) { int currentFilledIndex = 0; for (int i = 0; i \< this.size; i++) { <type> item = this.items[i]; if (!predicate.accept(item)) { // keep it if (currentFilledIndex != i) { this.items[currentFilledIndex] = item; } currentFilledIndex++; } } boolean changed = currentFilledIndex \< this.size; this.wipeAndResetTheEnd(currentFilledIndex); return changed; } private void wipeAndResetTheEnd(int newCurrentFilledIndex) { for (int i = newCurrentFilledIndex; i \< this.size; i++) { this.items[i] = <zero.(type)>; } this.size = newCurrentFilledIndex; }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
In the removeIf of primitive types, the template zeroes the remaining of the list.
Is it really necessary to do so?
The text was updated successfully, but these errors were encountered: