E
etienno
Hi,
I have a simple question about return type. Usually, I dont think much
about it, I usually returns the interface.
Per example, if I have a methode that returns an ArrayList, I usually
return a List in its signature:
public List getStuffList(){
return new ArrayList();
}
I need to explain that to my collegue (some returns Vector and
ArrayList). I would like to explain them that returning a List is
"better", but I cannot find much argument about it.... Yes, the
implementation can change without changing the signature, but what
else? Could someone gives me a better answer?
Tks
Etienne
I have a simple question about return type. Usually, I dont think much
about it, I usually returns the interface.
Per example, if I have a methode that returns an ArrayList, I usually
return a List in its signature:
public List getStuffList(){
return new ArrayList();
}
I need to explain that to my collegue (some returns Vector and
ArrayList). I would like to explain them that returning a List is
"better", but I cannot find much argument about it.... Yes, the
implementation can change without changing the signature, but what
else? Could someone gives me a better answer?
Tks
Etienne