reschke commented on code in PR #2111: URL: https://github.com/apache/jackrabbit-oak/pull/2111#discussion_r1967186962
########## oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/collections/IterableUtils.java: ########## @@ -212,4 +214,46 @@ public static <T> T[] toArray(final Iterable<T> itr, final Class<T> type) { final Collection<T> collection = itr instanceof Collection ? (Collection<T>) itr : ListUtils.toList(itr); return collection.toArray(t); } + + /** + * Splits an Iterable into an Iterator of sub-iterators, each of the specified size. + * + * @param <T> the type of elements in the itr + * @param itr the itr to split, may not be null + * @param size the size of each sub-iterator, must be greater than 0 + * @return an iterator of sub-iterators, each of the specified size + * @throws NullPointerException if the itr is null + * @throws IllegalArgumentException if size is less than or equal to 0 + */ + public static <T> Iterable<List<T>> partition(final Iterable<T> itr, final int size) { + if (itr == null) { Review Comment: Why can't we use "requireNonNull" here? (or even do not do it at all?) -- 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: oak-dev-unsubscr...@jackrabbit.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org