Class CollectionUtils

java.lang.Object
com.github.twitch4j.common.util.CollectionUtils

public class CollectionUtils extends Object
  • Constructor Details

    • CollectionUtils

      public CollectionUtils()
  • Method Details

    • chunked

      public static <T> List<List<T>> chunked(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 chunk
      size - the maximum size of each chunk
      Returns:
      a list of the chunks, or an empty list if the iterable yielded no elements
      Throws:
      NullPointerException - if the passed iterable is null