I'm guessing your colleague felt that something where a response
of 0 things to operate on is not an error condition it is easier to
deal with a 0 entry list, for example:
public int getFooTotalValue() {
int fooTotal = 0;
ListFoo fooList = getFooList();
for (Foo afoo :
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 ListObject where the single object is added to the array
list.
because, we can check for list.isEmpty() which is better than
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 fxswe...@gmail.com wrote:
A method is supposed to return a object when called.
Which is better to implement for
My colleague mentioned list is the better way of doing it. So that we don't
face null pointer exceptions. since we check for list.isEmpty()
But I wasn't sure, thats why I am checking.
On Monday, August 4, 2014 3:42:35 PM UTC-4, Steve Gabrilowitz wrote:
How would list.isEmpty() be better than
On Mon, Aug 4, 2014 at 2:51 PM, sweety fx fxswe...@gmail.com wrote:
My colleague mentioned list is the better way of doing it. So that we
don't face null pointer exceptions. since we check for list.isEmpty()
You're replacing one if check for another and making your code confusing.
This is not
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 fxswe...@gmail.com wrote:
A method is supposed to return a object when
6 matches
Mail list logo