mukund-thakur commented on a change in pull request #4045:
URL: https://github.com/apache/hadoop/pull/4045#discussion_r821469346
##########
File path:
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/Lists.java
##########
@@ -232,4 +232,20 @@ private static int saturatedCast(long value) {
return addAll(addTo, elementsToAdd.iterator());
}
+ public static <T> List<List<T>> partition(List<T> originalList, int
pageSize) {
+
+ Preconditions.checkArgument(originalList != null && originalList.size() >
0,
+ "Invalid original list");
+ Preconditions.checkArgument(pageSize > 0, "Page size should " +
+ "be greater than 0 for performing partition");
+
+ List<List<T>> result = new ArrayList<>();
Review comment:
subList() which is used below will return a view list only with the
underlying storage of original list.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]