mercredi 7 décembre 2016

Check if the list contains atlease one non null object

Is there any library method that will check if the List is not empty and has atleast one object which is not null.

Is there any better alternative for the following code

if( !list.isEmpty() && list.get(0) != null){
    ...
}

Please let me know if this piece of code can be improved in any way.

Aucun commentaire:

Enregistrer un commentaire