Remove unnecessary try-catch

This commit is contained in:
TheMode 2021-04-21 14:39:28 +02:00
parent 9660ee30fb
commit 15b116a770

View File

@ -120,30 +120,22 @@ public class CollectionView<E, V> implements Collection<E> {
@Override
public boolean removeAll(@NotNull Collection<?> c) {
boolean changed = false;
try {
for (Object e : c) {
if (remove(e))
changed = true;
}
} catch (ClassCastException ignored) {
for (Object e : c) {
if (remove(e))
changed = true;
}
return changed;
}
@Override
public boolean retainAll(@NotNull Collection<?> c) {
boolean changed = false;
try {
for (Object e : c) {
if (!contains(e)) {
remove(e);
changed = true;
}
for (Object e : c) {
if (!contains(e)) {
remove(e);
changed = true;
}
} catch (ClassCastException ignored) {
}
return changed;
}