Re: Question on Effective Java Item 27
- From: "Daniel T." <postmaster@xxxxxxxxxxx>
- Date: Fri, 21 Apr 2006 11:05:03 GMT
In article <e2a1oe$1fp$1@xxxxxxxxxxxxx>, "S Perryman" <a@xxxxx> wrote:
"Andrew McDonagh" <news@xxxxxxxxx> wrote in message
news:e28d7c$14v$1@xxxxxxxxxxxxxxxxxxxxxxxx
S Perryman wrote:
Because I haved programmed in different prog langs, I try to have a
consistent approach for a problem regardless of the prog lang.
So here it is multiple out parameters, or a suitable result type.
But never null = not found.
null for not found is common in Java though
e.g.
http://java.sun.com/j2se/1.4.2/docs/api/java/util/HashMap.html#get(java.lang
.Object)
HashMap
public Object get(Object key)
Returns the value to which the specified key is mapped in this
identity hash map, or null if the map contains no mapping for this key. A
return value of null does not necessarily indicate that the map contains
no mapping for the key; it is also possible that the map explicitly maps
the key to null. The containsKey method may be used to distinguish these
two cases.
QED.
I'm sorry, I read the above where is says that return value of null does
not indicate that the map contains no mapping for the key, and I can't
help but wonder... Does this method really return null if the map
contains no mapping for this key?
.
- Follow-Ups:
- Re: Question on Effective Java Item 27
- From: Andrew McDonagh
- Re: Question on Effective Java Item 27
- From: Daniel Parker
- Re: Question on Effective Java Item 27
- References:
- Question on Effective Java Item 27
- From: hforco@xxxxxxxxxxxxxx
- Re: Question on Effective Java Item 27
- From: S Perryman
- Re: Question on Effective Java Item 27
- From: hforco@xxxxxxxxxxxxxx
- Re: Question on Effective Java Item 27
- From: S Perryman
- Re: Question on Effective Java Item 27
- From: Andrew McDonagh
- Re: Question on Effective Java Item 27
- From: S Perryman
- Question on Effective Java Item 27
- Prev by Date: Q: Solutions for requirements tracing (to design, code, and test items)
- Next by Date: Re: Proper state behavior? (was: Question on LSP)
- Previous by thread: Re: Question on Effective Java Item 27
- Next by thread: Re: Question on Effective Java Item 27
- Index(es):
Relevant Pages
|