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;
|
int comparisonResult;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (item instanceof Comparable x &&
|
comparisonResult = ((Comparable) item).compareTo((Comparable) currentNode.getItem());
|
||||||
currentNode.getItem() instanceof Comparable y) {
|
|
||||||
comparisonResult = x.compareTo(y);
|
|
||||||
} else {
|
|
||||||
throw new UnsupportedOperationException();
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
comparisonResult = 0;
|
comparisonResult = 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue