【发布时间】:2019-12-31 11:27:27
【问题描述】:
Optional<Long>totalLanding= ....(get it from somewhere);
Optional<Long>totalSharing = ...(get it from somewhere);
我想做这样的事情不是语法而是逻辑
Optional<Long>total = totalLanding+totalSharing;
如果两者都为空,那么如果其中一个具有值,那么总计应该为空,那么总计应该具有该值,如果它们都具有该值,那么它们应该被添加并存储在总计中
【问题讨论】: