Interface Generator<T>

All Known Implementing Classes:
DelegatingGenerator, DigestGenerator, Md5, Sequence, Sha256
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface Generator<T>
A Generator is able to generate an infinite sequence of values. It's similar to Iterator with the difference that a generator always has a next element, hence there is no hasNext() method.

A Generator also serves as an equivalent to Single for mutable values. A Single should not be used with mutable values because mutation of the value would affect all other uses of the Single because other callers might receive the mutated value. A Generator on the other hand is expected to return (generate) a new instance on each call if the results are mutable.

  • Method Summary

    Modifier and Type
    Method
    Description
    Generates and returns another value.
  • Method Details

    • next

      T next()
      Generates and returns another value.