How would list.isEmpty() be better than object==null? If you never plan on returning more than one object then it makes no sense to use a list. On Aug 4, 2014 11:04 AM, "sweety fx" <[email protected]> wrote:
> A method is supposed to return a object when called. > > Which is better to implement for the method: > 1. Is it better to have the method return an object. > 2. Or return List<Object> where the single object is added to the array > list. > > because, we can check for list.isEmpty() which is better than > object!=null. not sure which one is better. > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > --- > You received this message because you are subscribed to the Google Groups > "Android Developers" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.

