LarsBodewig commented on a change in pull request #265:
URL:
https://github.com/apache/commons-collections/pull/265#discussion_r771770406
##########
File path: src/main/java/org/apache/commons/collections4/ListUtils.java
##########
@@ -486,13 +504,52 @@ public static String longestCommonSubsequence(final
CharSequence charSequenceA,
* @throws NullPointerException if list is null
* @throws IllegalArgumentException if size is not strictly positive
* @since 4.0
+ * @see ListUtils#partitionBalanced(List, int)
*/
public static <T> List<List<T>> partition(final List<T> list, final int
size) {
Objects.requireNonNull(list, "list");
if (size <= 0) {
throw new IllegalArgumentException("Size must be greater than 0");
}
- return new Partition<>(list, size);
+ return new Partition<>(list, size, false);
+ }
+
+ /**
+ * Returns consecutive {@link List#subList(int, int) sublists} of a
+ * list, partitioned in a way to balance entries across all sublists. For
example,
+ * partitioning a list containing {@code [a, b, c, d, e]} with a partition
+ * size of 3 yields {@code [[a, b, c], [d, e]]} -- an outer list containing
+ * two inner lists of three and two elements, all in the original order.
Partitioning
Review comment:
I see why you would use the example from `ListUtils.partition`, however
this could be confusing IMO if you start comparing what method to use and see
no difference so far. I would opt for a more clear example here.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]