Package com.github.twitch4j.common.util
Class CollectionUtils
java.lang.Object
com.github.twitch4j.common.util.CollectionUtils
public class CollectionUtils
extends java.lang.Object
-
Constructor Summary
Constructors Constructor Description CollectionUtils() -
Method Summary
Modifier and Type Method Description static <T> java.util.List<java.util.List<T>>chunked(java.lang.Iterable<T> iterable, int size)Assigns elements of the given iterable to chunks not exceeding the desired sizeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
CollectionUtils
public CollectionUtils()
-
-
Method Details
-
chunked
public static <T> java.util.List<java.util.List<T>> chunked(java.lang.Iterable<T> iterable, int size)Assigns elements of the given iterable to chunks not exceeding the desired size- Type Parameters:
T- type of the iterable- Parameters:
iterable- the source of elements to be assigned to a chunksize- the maximum size of each chunk- Returns:
- a list of the chunks, or an empty list if the iterable yielded no elements
- Throws:
java.lang.NullPointerException- if the passed iterable is null
-