Class ChunkIterator<T>

java.lang.Object
dev.dimlight.maven.plugin.shellcheck.ChunkIterator<T>
Type Parameters:
T - the type of elements in the original list.
All Implemented Interfaces:
Iterator<List<T>>

public class ChunkIterator<T> extends Object implements Iterator<List<T>>
A stateful decorator to divide a list in chunks of a (at most) given size.
Author:
Marco Nicolini
  • Method Details

    • over

      public static <T> Iterator<List<T>> over(int chunkSize, Iterable<T> iterable)
      Type Parameters:
      T - the type of elements in the iterable
      Parameters:
      chunkSize - the max chunk size.
      iterable - the iterable we want to iterate over (in chunk)
      Returns:
      an iterator that will group items in chunks of (maximum) given chunk size.
    • hasNext

      public boolean hasNext()
      Specified by:
      hasNext in interface Iterator<T>
    • next

      public List<T> next()
      Specified by:
      next in interface Iterator<T>