code: public static <X> ArrayList<X> sublist(List<X> list, int start, int end) {
          ArrayList<X> sublist = new ArrayList<X>();
          for (int i=start; i<end; i++) {
              sublist.add(list.get(i));
          }
          return sublist;
      }
docs: Creates a new list containing a slice of the original list.
  @param list The original list.
  @param start The index of the first element of the slice (inclusive).
  @param end The index of the last element of the slice (exclusive).
  @return A sublist containing elements [start, end).