[collections] why not use delegation in MultiHashMap

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[collections] why not use delegation in MultiHashMap

Torsten Curdt
Is there any particular reason why we don't use
delegation to provide the collection for the
MultiHashMap?

    /**
     * Creates a new instance of the map value Collection container.
     * <p>
     * This method can be overridden to use your own collection type.
     *
     * @param coll  the collection to copy, may be null
     * @return the new collection
     */
    protected Collection createCollection(Collection coll) {
        if (coll == null) {
            return new ArrayList();
        } else {
            return new ArrayList(coll);
        }
    }

cheers
--
Torsten

signature.asc (193 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

RE: [collections] why not use delegation in MultiHashMap

James Carman
There is a new, generic version of MultiHashMap, called MultiValueMap (in
the map package) in Commons Collections which does what you're asking for.
It's available via SVN.

-----Original Message-----
From: Torsten Curdt [mailto:[hidden email]]
Sent: Thursday, July 07, 2005 10:21 AM
To: Jakarta Commons Developers List
Subject: [collections] why not use delegation in MultiHashMap

Is there any particular reason why we don't use
delegation to provide the collection for the
MultiHashMap?

    /**
     * Creates a new instance of the map value Collection container.
     * <p>
     * This method can be overridden to use your own collection type.
     *
     * @param coll  the collection to copy, may be null
     * @return the new collection
     */
    protected Collection createCollection(Collection coll) {
        if (coll == null) {
            return new ArrayList();
        } else {
            return new ArrayList(coll);
        }
    }

cheers
--
Torsten


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [collections] why not use delegation in MultiHashMap

Torsten Curdt
James Carman wrote:
> There is a new, generic version of MultiHashMap, called MultiValueMap (in
> the map package) in Commons Collections which does what you're asking for.
> It's available via SVN.

Ah ...cool - thanks for the hint!

...will have a look

cheers
--
Torsten

signature.asc (193 bytes) Download Attachment