code: static <E> List<E> subListImpl(final List<E> list, int fromIndex, int toIndex) {
      List<E> wrapper;
      if (list instanceof RandomAccess) {
        wrapper =
            new RandomAccessListWrapper<E>(list) {
              @Override
              public ListIterator<E> listIterator(int index) {
                return backingList.listIterator(index);
              }
  
              private static final long serialVersionUID = 0;
            };
      } else {
        wrapper =
            new AbstractListWrapper<E>(list) {
              @Override
              public ListIterator<E> listIterator(int index) {
                return backingList.listIterator(index);
              }
  
              private static final long serialVersionUID = 0;
            };
      }
      return wrapper.subList(fromIndex, toIndex);
    }
docs: An implementation of {@link List#subList(int, int)}.