JingsongLi commented on a change in pull request #12923: URL: https://github.com/apache/flink/pull/12923#discussion_r458505381
########## File path: flink-core/src/main/java/org/apache/flink/util/CollectionUtil.java ########## @@ -99,4 +100,18 @@ public static boolean isNullOrEmpty(Map<?, ?> map) { iterable.iterator().forEachRemaining(list::add); return list; } + + /** + * Collects the elements in the Iterator in a List. If the iterator argument is null, + * this method returns an empty list. + */ + public static <E> List<E> iteratorToList(@Nullable Iterator<E> iterator) { Review comment: According to `IteratorUtils.toList`, if iterator is null, should throw NPE. I think it is good to be consistent with commons-collections. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org