I have list which can be null sometimes, the return type should be int ex:
int size = 0;
if(list != null) {
size = list.size;
}
Could you please let me know whether any utility is available?
Thanks.
What about
int size = (list == null) ? 0 : list.size();
I'm not sure why you would want a utility for this, since the above seems simple enough.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With