List of utility methods to do List Slice
List | slice(List as, int start, int end) slice return as.subList(start, end);
|
List | slice(List Returns a sub list with the provided indices. List<T> result = new ArrayList<T>(); if (c == null) { return result; int len = c.size(); if (fromIndex > len || toIndex > len || fromIndex < -len || toIndex < -len) { throw new IndexOutOfBoundsException("fromIndex or toIndex out of bounds"); if (len > 0 && fromIndex >= len) { throw new IndexOutOfBoundsException("fromIndex or toIndex out of bounds"); if (fromIndex < 0) { fromIndex += len; if (toIndex < 0) { toIndex += len + 1; } else if (toIndex == 0 && len > 0 || toIndex > 0) { toIndex++; return new ArrayList<T>(c.subList(fromIndex, toIndex)); |
List | slice(List slice List<T> result = new ArrayList<T>(); if (index >= 0 && index < list.size()) { int end = index + count < list.size() ? index + count : list.size(); for (int i = index; i < end; i++) { result.add(list.get(i)); return result; ... |
List | slice(List slice List<T> sliced = new ArrayList<>(); for (int i = start; i < end && i < list.size(); i++) { sliced.add(list.get(i)); return sliced; |
List | slice(List Slices a list, Python style int size = list.size(); if (start == null) { start = 0; } else if (start < 0) { start = size + start; if (stop == null) { stop = size; ... |
List | sliceList(final List slice List checkList(list, Integer.MAX_VALUE); int len = list.size(); if (offset > len) { return new ArrayList<Long>(0); return list.subList((int) offset, min((int) (offset + limit), len)); |
ArrayList | sliceListByIndices(final List Given a list of indices into a list, return those elements of the list with the possibility of drawing list elements multiple times ArrayList<T> subset = new ArrayList<T>(); for (int i : indices) { subset.add(list.get(i)); return subset; |
List
| slices(List slices return slices(list, 0, list.size(), step);
|