Link to home
Start Free TrialLog in
Avatar of srikotesh
srikotesh

asked on

Is there any advantages using Optional rather than checking list is null or empty

Hi Experts,

Optional.ofNullable(list).isPresent()

if(!list.isEmpty() && list!=null)

what is the difference b/w the above two statements?
what is the advantage use of Optional
ASKER CERTIFIED SOLUTION
Avatar of zzynx
zzynx
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial