code: public static <T> List<T> copyOfRange(final List<T> c, int from, final int to, final int step) {
          N.checkFromToIndex(from < to ? from : (to == -1 ? 0 : to), from < to ? to : from, c.size());
  
          if (step == 0) {
              throw new IllegalArgumentException("The input parameter 'by' can not be zero");
          }
  
          if (from == to || from < to != step > 0) {
              return new ArrayList<>();
          }
  
          if (step == 1) {
              return copyOfRange(c, from, to);
          }
  
          from = from > to ? N.min(c.size() - 1, from) : from;
          final int len = (to - from) / step + ((to - from) % step == 0 ? 0 : 1);
          List<T> result = null;
  
          if (c instanceof RandomAccess) {
              result = new ArrayList<>(len);
  
              for (int i = 0, j = from; i < len; i++, j += step) {
                  result.add(c.get(j));
              }
          } else {
              final T[] a = (T[]) c.subList(from, to).toArray();
              result = createList(N.copyOfRange(a, 0, a.length, step));
          }
  
          return result;
      }
docs: Copy all the elements in <code>original</code>, through <code>to</code>-<code>from</code>, by <code>step</code>.
  
  @param c
  @param from
  @param to
  @param step
  @return