Class StreamableCollection<T>

Object
StreamableCollection<T>
Type Parameters:
T - element-type in stream

public class StreamableCollection<T> extends Object
As a stream can only be used once, this data-structure allows for repeatedly getting streams from a collection.
Author:
Owen Feehan
  • Constructor Details

    • StreamableCollection

      public StreamableCollection(Collection<T> collection)
      Create for a particular collection
      Parameters:
      collection - the collection
    • StreamableCollection

      public StreamableCollection(Supplier<Stream<T>> supplier)
      Creates a new StreamableCollection instance.
      Parameters:
      supplier - Supplies a stream of elements.
  • Method Details

    • stream

      public Stream<T> stream()
      A single instance of the stream from the supplier.
      Returns:
      an instance of the stream via a call to Supplier.get() for supplier.