List of utility methods to do List Partition
List
| partition(final List partition if (items == null) { throw new IllegalArgumentException("Items must not be null"); if (size < 0) { throw new IllegalArgumentException("Size must be more than 0"); final int maxIndex = items.size() < size ? items.size() : size; final List<List<T>> lists = new ArrayList<>(); ... |
List
| partition(final List Partitions a list of objects into smaller lists final List<List<T>> parts = new ArrayList<>(); for (int i = 0; i < list.size(); i += length) { parts.add(new ArrayList<>(list.subList(i, Math.min(list.size(), i + length)))); return parts; |
List
| partition(List Partition a list in sub-lists, with max size equal to 'batchSize' parameter. List<List<E>> retObj = new ArrayList<List<E>>(); if (isNotEmpty(list)) { retObj = new ArrayList<List<E>>(); List<E> currentList = null; for (int i = 0; i < list.size(); i++) { if (i % batchSize == 0) { currentList = new ArrayList<E>(); retObj.add(currentList); ... |
List
| partition(List partition List<List<Long>> partitions = new ArrayList<>(); final int count = all.size(); for (int i = 0; i < count; i += partitionSize) { partitions.add(new ArrayList<>(all.subList(i, Math.min(count, i + partitionSize)))); return partitions; |
int | partition(List Performs QuickSort partitioning: Rearranges an array in two partitions. T x = a.get(upper); int i = lower - 1; for (int j = lower; j < upper; j++) { if (a.get(j).compareTo(x) <= 0) { i++; exchange(a, i, j); exchange(a, i + 1, upper); return i + 1; |
List
| partition(List partition double size = items.size() / (double) slices; double accum = 0; int start = 0; List<List<T>> list = new ArrayList<>(slices); for (int i = 0; i < slices; i++) { int end = (int) Math.floor(accum + size); if (i == slices - 1) end = items.size(); ... |
List
| partition(List Partition a list into num sub-lists.
if (num < 1) { throw new IllegalArgumentException("Number of sub-lists must be greater than zero"); List<List<T>> result = new ArrayList<List<T>>(); int index = 0; int listsRemaining = num; int elementsRemaining = list.size(); while (elementsRemaining > 0) { ... |
List
| partition(List Partitions a list into multiple smaller lists from a partition size. List<List<T>> partitions = new ArrayList<>(); final int algebraN = list.size(); for (int i = 0; i < algebraN; i += partitionSize) { partitions.add(new ArrayList<T>(list.subList(i, Math.min(algebraN, i + partitionSize)))); return partitions; |
List
| partition(List partition if (size <= 0) { throw new IllegalArgumentException("bad size: " + size); List<List<T>> lists = new ArrayList<>(); for (int i = 0; i < list.size(); i += size) { int fromIndex = i; int toIndex = fromIndex + size; toIndex = toIndex > list.size() ? list.size() : toIndex; ... |
List
| partition(List partition if (size <= 0) { throw new IllegalArgumentException("Size should be >= 0"); if (list == null) { throw new IllegalArgumentException("List can't be null"); List<List<T>> partitions = new ArrayList<List<T>>(list.size() / size); List<T> partition = new ArrayList<T>(size); ... |