mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-09 22:01:02 +00:00
fixed some border cases with subsetting a track that leads to empty track; 0 errors, 5 failures
This commit is contained in:
1 parent
905563c35d
commit
05e34fbeb0
1 file changed
+13
@@ -283,6 +283,9 @@ public class ArrayListNavigableSet<E> implements NavigableSet<E> {
|
||||
to--;
|
||||
}
|
||||
}
|
||||
if (to < from) {
|
||||
to = from; // will still produce an empty list instead of failing with an exception
|
||||
}
|
||||
return new ArrayListNavigableSet<E>(list.subList(from, to), comparator());
|
||||
}
|
||||
|
||||
@@ -296,6 +299,9 @@ public class ArrayListNavigableSet<E> implements NavigableSet<E> {
|
||||
to--;
|
||||
}
|
||||
}
|
||||
if (to < 0) {
|
||||
to = 0; // will still produce an empty list instead of failing with an exception
|
||||
}
|
||||
return new ArrayListNavigableSet<E>(list.subList(0, to), comparator());
|
||||
}
|
||||
|
||||
@@ -309,6 +315,9 @@ public class ArrayListNavigableSet<E> implements NavigableSet<E> {
|
||||
from++;
|
||||
}
|
||||
}
|
||||
if (from > list.size()) {
|
||||
from = list.size(); // will still produce an empty list instead of failing with an exception
|
||||
}
|
||||
return new ArrayListNavigableSet<E>(list.subList(from, list.size()), comparator());
|
||||
}
|
||||
|
||||
@@ -331,4 +340,8 @@ public class ArrayListNavigableSet<E> implements NavigableSet<E> {
|
||||
return comparator().compare(a, b);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return list.toString();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user