It would be my opinion that you return a Object if you do not intend to return any more than one of them. Else it may become confusing reading your code later.
Regards Damien On Tue, Aug 5, 2014 at 12:34 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.

