mardi 17 décembre 2019

Avoiding If statement to check if object is Null

I'm using Lombok S1F4j to log my data and In order to avoid logging empty data , I check if the object is null or not . I want avoid this guys so my code is more robuste and so easy to test .

This is an example :

if (object != null)
 {
log.info("lalalalal", object)
object1.set(object)  }

Is there anyway to avoid checking null and not logging if object is null ?

Aucun commentaire:

Enregistrer un commentaire