List of utility methods to do List Partition
List
| partition(List partition List<List<T>> result = new ArrayList<List<T>>(list.size() / size); for (int i = 0; i < list.size(); i += size) { if (i + size < list.size()) result.add(list.subList(i, i + size)); else result.add(list.subList(i, list.size())); return result; ... |
List
| partition(List partition List<List<T>> result = new ArrayList<List<T>>(); if (longList == null || longList.isEmpty()) return result; if (longList.size() <= length) { result.add(longList); } else { int groups = (longList.size() - 1) / length + 1; for (int i = 0; i < groups - 1; i++) { ... |
List
| partition(List partition if (orig == null) { throw new NullPointerException("The list to partition must not be null"); if (size < 1) { throw new IllegalArgumentException("The target partition size must be 1 or greater"); int origSize = orig.size(); List<List<T>> result = new ArrayList<>(origSize / size + 1); ... |
List
| partition(List partition List<List<T>> partitionedList = new ArrayList<>(); if (sourceList.isEmpty()) { partitionedList.add(Collections.<T>emptyList()); return partitionedList; int actualNumberOfSegments = Math.min(sourceList.size(), numberOfSegments); for (int i = 0; i < actualNumberOfSegments; i++) partitionedList.add(new ArrayList<T>()); ... |
List | partitionIntoFolds(List Split a list into numFolds (roughly) equally sized folds. List<Collection<T>> folds = new ArrayList<Collection<T>>(); int numValues = values.size(); int foldSize = numValues / numFolds; int remainder = numValues % numFolds; int start = 0; int end = foldSize; for (int foldNum = 0; foldNum < numFolds; foldNum++) { if (foldNum < remainder) { ... |
List
| partitionList(final List partition List final List<List<T>> listOfChunks = new ArrayList<List<T>>(); for (int i = 0; i < originalList.size() / chunkSize; i++) { listOfChunks.add(originalList.subList(i * chunkSize, i * chunkSize + chunkSize)); if (originalList.size() % chunkSize != 0) { listOfChunks.add(originalList.subList(originalList.size() - originalList.size() % chunkSize, originalList.size())); return listOfChunks; |
List[] | partitionList(List list, int folds) partition List List[] partitions = new List[folds]; int partitionSize = list.size() / folds, index; for (int i = 0; i < folds; i++) { index = i * partitionSize; partitions[i] = list.subList(index, i < folds - 1 ? index + partitionSize : list.size()); return partitions; |
List
| partitionList(List Partition a list into sublists of length L. assert partitionSize > 0; assert list != null; final List<List<T>> res = new ArrayList<>(); for (int i = 0; i < list.size(); i += partitionSize) { res.add(list.subList(i, Math.min(list.size(), i + partitionSize))); return res; |
List
| partitionVariable(List This will partition the given whole variable data applyTransformToDestination in to the specified chunk number. int count = 0; List<List<Double>> ret = new ArrayList<>(); while (count < arr.size()) { List<Double> sublist = arr.subList(count, count + chunk); count += chunk; ret.add(sublist); for (List<Double> lists : ret) { ... |
void | removePartition(List remove Partition for (int i = 0; i < donorPartitionList.size(); i++) { if (partition == donorPartitionList.get(i)) { donorPartitionList.remove(i); |