Thai Dang Vu thanks for pointing this out! I’ve used
grouped quite a few times, mostly for processing the data in batches of limited size, but somehow forgot to mention it. Updated the post.
Good point, François! Missed this. So, min/max throw
UnsupportedOperationException, while head/last throw
NoSuchElementException. Actually, this makes the automatic refactoring by IntelliJ invalid, since it alters the behavior.
Updated my post, thank you.