public static DoubleStreamEx produce(Predicate<DoubleConsumer> producer) {
        Box<DoubleEmitter> box = new Box<>();
        return (box.a = action -> producer.test(action) ? box.a : null).stream();
    }
public static DoubleStreamEx produce ( Predicate < DoubleConsumer > producer ) { Box < DoubleEmitter > box = new Box < > ( ) ; return ( box . a = action -> producer . test ( action ) ? box . a : null ) . stream ( ) ; }
Return an ordered stream produced by consecutive calls of the supplied
producer until it returns false.

<p>
The producer function may call the passed consumer any number of times
and return true if the producer should be called again or false
otherwise. It's guaranteed that the producer will not be called anymore,
once it returns false.

<p>
This method is particularly useful when producer changes the mutable
object which should be left in known state after the full stream
consumption. Note however that if a short-circuiting operation is used,
then the final state of the mutable object cannot be guaranteed.

@param producer a predicate which calls the passed consumer to emit
stream element(s) and returns true if it producer should be
applied again.
@return the new stream
@since 0.6.0