You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by James Carman <ja...@carmanconsulting.com> on 2004/02/25 19:50:03 UTC

[COLLECTIONS] MultiHashMap.get()

In the documentation for MultiHashMap, it claims "Getting a value will
always return a Collection, holding all the values put to that key."
However, the following code fails...

 

final MultiHashMap map = new MultiHashMap();

assertNotNull( map.get( "Hello" ) );

 

>From the documentation, I would think that the get() method should return an
EMPTY (and probably unmodifiable) collection, not a null reference.  Am I
misinterpreting it?

 


Re: [COLLECTIONS] MultiHashMap.get()

Posted by Stephen Colebourne <sc...@btopenworld.com>.
Javadoc of MultiMap improved dramatically. This involved adding methods to
the MultiMap interface, however they override methods in Map so the change
is backwards compatible.
Stephen

----- Original Message -----
From: "Stephen Colebourne" <sc...@btopenworld.com>
> Yes, this will need a javadoc fix. The null is returned to indicate that
> there are no values mapped to this key (as per normal Map API).
>
> Stephen
>
> ----- Original Message -----
> From: "James Carman" <ja...@carmanconsulting.com>
> In the documentation for MultiHashMap, it claims "Getting a value will
> always return a Collection, holding all the values put to that key."
> However, the following code fails...
>
>
>
> final MultiHashMap map = new MultiHashMap();
>
> assertNotNull( map.get( "Hello" ) );
>
>
>
> From the documentation, I would think that the get() method should return
an
> EMPTY (and probably unmodifiable) collection, not a null reference.  Am I
> misinterpreting it?
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [COLLECTIONS] MultiHashMap.get()

Posted by Stephen Colebourne <sc...@btopenworld.com>.
Yes, this will need a javadoc fix. The null is returned to indicate that
there are no values mapped to this key (as per normal Map API).

Stephen

----- Original Message -----
From: "James Carman" <ja...@carmanconsulting.com>
In the documentation for MultiHashMap, it claims "Getting a value will
always return a Collection, holding all the values put to that key."
However, the following code fails...



final MultiHashMap map = new MultiHashMap();

assertNotNull( map.get( "Hello" ) );



>From the documentation, I would think that the get() method should return an
EMPTY (and probably unmodifiable) collection, not a null reference.  Am I
misinterpreting it?






---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org