Suppress unnecessary warnings

This commit is contained in:
Manuel Thalmann 2022-09-28 09:47:07 +02:00
parent 8a80db94a9
commit aee1199bee

View file

@ -197,15 +197,14 @@ public class MyList extends AbstractList<Object> {
}
@Override
@SuppressWarnings("unchecked")
@SuppressWarnings({ "rawtypes", "unchecked" })
public boolean remove(Object o) {
for (IListNode node = getAnchor().getNextNode(); node != getAnchor(); node = node.getNextNode()) {
boolean isEqual = false;
try {
isEqual = ((Comparable<Object>)o).compareTo((node.getItem())) == 0;
}
catch (Exception e) {
isEqual = ((Comparable) o).compareTo((node.getItem())) == 0;
} catch (Exception e) {
isEqual = node.getItem() == o;
}