Optional<Long>totalLanding= ....(get it from somewhere);
Optional<Long>totalSharing = ...(get it from somewhere);
Run Code Online (Sandbox Code Playgroud)
我想做这样的事情不是在语法上而是在逻辑上
Optional<Long>total = totalLanding+totalSharing;
Run Code Online (Sandbox Code Playgroud)
这样,如果两者都为空,则总计应该为空,如果其中一个具有该值,则总计应该具有该值,如果它们都具有该值,那么它们应该被添加并存储在总计中