IntList list = new IntArrayList();
list.add(1);
list.add(2);
list.add(3);
list = new IntImmutableList(list);
IntList subList = list.subList(1, 3);
for (int i : subList) {
System.out.println("i = " + i);
}
gives:
i = 2
i = 3
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Index 3 out of bounds for length 3
at it.unimi.dsi.fastutil.ints.IntImmutableList$ImmutableSubList$1.nextInt(IntImmutableList.java:483)
at it.unimi.dsi.fastutil.ints.IntIterator.next(IntIterator.java:46)
at it.unimi.dsi.fastutil.ints.IntListIterator.next(IntListIterator.java:103)
at it.unimi.dsi.fastutil.ints.IntListIterator.next(IntListIterator.java:31)
Version 8.5.12 How to reproduce:
gives: