mirror of
https://github.com/openjdk/jdk.git
synced 2026-05-17 17:07:53 +00:00
8356486: ReverseOrderListView should override reversed() to return base
Reviewed-by: liach, smarks
This commit is contained in:
parent
45cf32bd2c
commit
43008b42cf
@ -43,9 +43,7 @@ class ReverseOrderListView<E> implements List<E> {
|
||||
final boolean modifiable;
|
||||
|
||||
public static <T> List<T> of(List<T> list, boolean modifiable) {
|
||||
if (list instanceof ReverseOrderListView<T> rolv) {
|
||||
return rolv.base;
|
||||
} else if (list instanceof RandomAccess) {
|
||||
if (list instanceof RandomAccess) {
|
||||
return new ReverseOrderListView.Rand<>(list, modifiable);
|
||||
} else {
|
||||
return new ReverseOrderListView<>(list, modifiable);
|
||||
@ -395,6 +393,10 @@ class ReverseOrderListView<E> implements List<E> {
|
||||
return new ReverseOrderListView<>(base.subList(size - toIndex, size - fromIndex), modifiable);
|
||||
}
|
||||
|
||||
public List<E> reversed() {
|
||||
return base;
|
||||
}
|
||||
|
||||
static void checkClosedRange(int index, int size) {
|
||||
if (index < 0 || index > size) {
|
||||
throw new IndexOutOfBoundsException("Index: " + index + ", Size: " + size);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user