Class StreamUtil

java.lang.Object
ca.uhn.fhir.util.StreamUtil

public class StreamUtil extends Object
  • Method Details

    • partition

      public static <T> Stream<List<T>> partition(Stream<T> theStream, int theChunkSize)
      Chunk the stream into Lists of size theChunkSize. The last chunk will be smaller unless the stream size is evenly divisible. Closes the underlying stream when done.
      Parameters:
      theStream - the input stream
      theChunkSize - the chunk size.
      Returns:
      a stream of chunks