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 @Override
@SuppressWarnings("unchecked") @SuppressWarnings({ "rawtypes", "unchecked" })
public boolean remove(Object o) { public boolean remove(Object o) {
for (IListNode node = getAnchor().getNextNode(); node != getAnchor(); node = node.getNextNode()) { for (IListNode node = getAnchor().getNextNode(); node != getAnchor(); node = node.getNextNode()) {
boolean isEqual = false; boolean isEqual = false;
try { try {
isEqual = ((Comparable<Object>)o).compareTo((node.getItem())) == 0; isEqual = ((Comparable) o).compareTo((node.getItem())) == 0;
} } catch (Exception e) {
catch (Exception e) {
isEqual = node.getItem() == o; isEqual = node.getItem() == o;
} }