Is it good idea to use Optional.of() method to make method chaining?

前端 未结 3 1956
误落风尘
误落风尘 2021-01-07 04:07

Is it good idea to use Optional.of() method to make method chaining ?

i had a conversation with group of collegues about Optional.of() method. currently one of the

3条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-07 04:30

    If initTxDataResponse is nullable, then maybe it should be like this ?

    Optional initTxDataResponse = 
            gateway.initiateTx(initTxDataRequest);
    
    response.map(....)
    

提交回复
热议问题