cleaning, refactoring, adding missing classes, attr, ..

It’s fine, but you have to do the null check first, because if it’s null you won’t be able to call isEmpty().


From: David Fernandez [mailto:notifications@github.com]
Sent: June 28, 2014 10:20 AM
To: mokalab/Butler
Cc: Antonio Tari
Subject: Re: [Butler] cleaning, refactoring, adding missing classes, attr, .. (#1)


In ButlerLibrary/src/main/java/com/mokalab/butler/util/JsonUtils.java:

> @@ -5,7 +5,7 @@

>  import org.json.JSONObject;

>

>  /**

> - * Created by work on 2014-06-13.

> + * TODO: It is recommended to return always empty instead of null.

>   */

@Pirdod<https://github.com/Pirdod> @antoniotari<https://github.com/antoniotari> what do you think?

I want to avoid doing this....
List list = getSomeMethodList();
if(list != null && !list.isEmpty()){
//do stuff
}

I recommend to return empty objects always.
if(!list.isEmpty()){
//do stuff
}

—
Reply to this email directly or view it on GitHub<https://github.com/mokalab/Butler/pull/1/files#r14324492>.