Java 从这个三元运算符中选择什么作为这个setter的值?

Java 从这个三元运算符中选择什么作为这个setter的值?,java,Java,选择什么 ccnCustomizedLabelData.setCCN_TRANSPORTATION_MODE(null != shipRequestVo.getTransportationMode() ? shipRequestVo.getTransportationMode() : null); 如果为空!=shipRequestVo.getTransportationMode()不等于null,则该值是shipRequestVo.getTransportationMode(

选择什么

        ccnCustomizedLabelData.setCCN_TRANSPORTATION_MODE(null != shipRequestVo.getTransportationMode() ? shipRequestVo.getTransportationMode() : null);

如果为空!=shipRequestVo.getTransportationMode()不等于null,则该值是shipRequestVo.getTransportationMode()返回的值

否则返回null

删除冗余代码,您将更清楚地看到它“那么该值就是nul!=shipRequestVo.getTransportationMode()返回的值”。不,应该是:“那么这个值就是shipRequestVo.getTransportationMode()返回的值。”基本上:它总是返回shipRequestVo.getTransportationMode()的值,这里的条件是不需要操作,愚蠢的错误,修复了它
null != shipRequestVo.getTransportationMode() ? shipRequestVo.getTransportationMode() : null