Make MySortedList
compatible with Java 8
This commit is contained in:
parent
3f6493694c
commit
bf793a8cea
1 changed files with 1 additions and 6 deletions
|
@ -16,12 +16,7 @@ public class MySortedList extends MyList {
|
|||
int comparisonResult;
|
||||
|
||||
try {
|
||||
if (item instanceof Comparable x &&
|
||||
currentNode.getItem() instanceof Comparable y) {
|
||||
comparisonResult = x.compareTo(y);
|
||||
} else {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
comparisonResult = ((Comparable) item).compareTo((Comparable) currentNode.getItem());
|
||||
} catch (Exception e) {
|
||||
comparisonResult = 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue