2021年5月6日星期四

Why use Optional.of method if a missing value is not permitted per business logic

Instead of initialising optCar variable as below:

Optional<'Car'> optCar = Optional.of(car);  

Why not initialise it simply as :

Car optCar = car;  

When a business logic does not permit car to be null?

https://stackoverflow.com/questions/67429148/why-use-optional-of-method-if-a-missing-value-is-not-permitted-per-business-logi May 07, 2021 at 12:47PM

没有评论:

发表评论