Class IndexStream

java.lang.Object
io.github.viimeinen1.ainventory.IndexStream

public class IndexStream extends Object
Helper to make streaming values to inventory easier.
  • Constructor Details

    • IndexStream

      public IndexStream()
  • Method Details

    • toStream

      public static <T> Stream<IndexStream.StreamValue<T>> toStream(Collection<T> collection)
      Convert collection to stream with IndexStream.StreamValues. Order might be random. Indexes will start at 0. Use Stream.limit(long) to limit the amount of values in the stream. Usage: aValueStream.toStream(collection).limit(limit).forEach(val -> {val.index(); val.value()});
      Type Parameters:
      T - Collection value type
      Parameters:
      collection - Collection
      Returns:
      Stream of IndexStream.StreamValue with index and value