@Test public void check_sublist() { List<Integer> subList = subList(30); VirtualList<Integer> virtualList = new VirtualList<>(subList, 50, 100); List<Integer> subList2 = virtualList.subList(50, 65); Assertions.assertThat(subList2).contains(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14); }
List<T> subList(long from, long to) { if (fullListSize > 0 && to - from > 0) { checkRange(from); checkRange(to - 1); assertSubRange(from, to - 1); return subList.subList((int) (from - subListOffset), (int) (to - subListOffset)); } return new ArrayList<>(); }
VirtualList { List<T> subList(long from, long to) { if (fullListSize > 0 && to - from > 0) { checkRange(from); checkRange(to - 1); assertSubRange(from, to - 1); return subList.subList((int) (from - subListOffset), (int) (to - subListOffset)); } return new ArrayList<>(); } }
VirtualList { List<T> subList(long from, long to) { if (fullListSize > 0 && to - from > 0) { checkRange(from); checkRange(to - 1); assertSubRange(from, to - 1); return subList.subList((int) (from - subListOffset), (int) (to - subListOffset)); } return new ArrayList<>(); } VirtualList(List<T> subList, long subListOffset, long fullListSize); }
VirtualList { List<T> subList(long from, long to) { if (fullListSize > 0 && to - from > 0) { checkRange(from); checkRange(to - 1); assertSubRange(from, to - 1); return subList.subList((int) (from - subListOffset), (int) (to - subListOffset)); } return new ArrayList<>(); } VirtualList(List<T> subList, long subListOffset, long fullListSize); long size(); }
VirtualList { List<T> subList(long from, long to) { if (fullListSize > 0 && to - from > 0) { checkRange(from); checkRange(to - 1); assertSubRange(from, to - 1); return subList.subList((int) (from - subListOffset), (int) (to - subListOffset)); } return new ArrayList<>(); } VirtualList(List<T> subList, long subListOffset, long fullListSize); long size();  }