Package org.dmfs.jems2
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.
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
-
Method Details
-
next
T next()Generates and returns another value.
-