title: How to add two Optional<Long> in java
body: <pre><code>Optional&lt;Long&gt;totalLanding= ....(get it from somewhere);
  Optional&lt;Long&gt;totalSharing = ...(get it from somewhere);
  </code></pre>
  
  <p>I want to do something like this not syntactically but logically</p>
  
  <pre><code>Optional&lt;Long&gt;total = totalLanding+totalSharing;
  </code></pre>
  
  <p>Such that if both are empty then total should be empty if one of them has the value then total should have that value is both of them have the value then they should get added and stored in total</p>