title: How to re-use a variable in multiple Mono operators?
body: <p>Consider this code:</p>
  
  <pre><code>Mono.just(myVar)
      .flatMap(MyClass::heavyOperation)
      .flatMap(MyClass::anotherHeavyOperation)
      .flatMap(res -&gt; doSomething(res, MyClass.heavyOperation(myVar)));
  </code></pre>
  
  <p>I don't want to call twice <code>MyClass.heavyOperation(myVar)</code> with the same input for the sake of performance.</p>
  
  <p>How can I reuse the result of the second operation in the fourth one?</p>
  
  <p>I want to do something like this, which is forbidden:</p>
  
  <pre><code>Object myObj;
  Mono.just(myVar)
      .flatMap(var -&gt; {
                 myObj = MyClass.heavyOperation(var);                  
                 return myObj;
                 })
      .flatMap(MyClass::anotherHeavyOperation)
      .flatMap(res -&gt; doSomething(res, myObj));
  </code></pre>