You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Henri Yandell <ba...@generationjava.com> on 2003/02/19 23:17:36 UTC

[collections] SequencedMultiMap

I want a SequencedMultiMap. It ought to be created by:

Map smm = new SequencedMap( new MultiMap( new HashMap() ) )

but all we have are the un-reusable:

MultiHashMap and SequencedHashMap.

[This also breaks the Collections spec, as passing a collection in is
meant to imply a copy, so it'd need to be:

SequencedMap.wrap( MultiMap.wrap( new HashMap() ) ); ]

I'm sure I've grumbled about this before, but am unsure what the view was.

Does anyone mind me rewriting MultiHashMap/SequencedHashMap so they have
wrap methods and so they extend ProxyMap?

I'd prefer to rename them then too. This however causes obvious
deprecation issues. It seems that I should deprecate the current HashMap
versions and create new ones.

Any preferences?

Hen


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


Re: [collections] SequencedMultiMap

Posted by Stephen Colebourne <sc...@btopenworld.com>.
The main problem with a number of the [collections] implementations is that
they extend the JDK implementation classes directly rather than the
interfaces. In some cases (LinkedList ones for example), the java LinkedList
class has methods over and above the List interface that are useful. This is
actually a bit of a flaw in the JDK.

For MultiMaps we are fairly devoid of implementations. The MapUtils class
has Predicated, Synchronized, Unmodifiable, FixedSize and Lazy decorators
for Map and SortedMap, but not for MultiMap.

If sequenced can be treated as a decoration, then it should be added to
MapUtils. The current SequencedHashMap implementation is quite complex
however, and I suspect that adding it as a decorator in MapUtils may be
difficult. So yes, you may need to create a SequencedMap top level class
with wrap methods. (Not sure what to call the MultiMap implementation, as
MultiMap is the interface...)

Stephen

From: "Henri Yandell" <ba...@generationjava.com>
> I want a SequencedMultiMap. It ought to be created by:
>
> Map smm = new SequencedMap( new MultiMap( new HashMap() ) )
>
> but all we have are the un-reusable:
>
> MultiHashMap and SequencedHashMap.
>
> [This also breaks the Collections spec, as passing a collection in is
> meant to imply a copy, so it'd need to be:
>
> SequencedMap.wrap( MultiMap.wrap( new HashMap() ) ); ]
>
> I'm sure I've grumbled about this before, but am unsure what the view was.
>
> Does anyone mind me rewriting MultiHashMap/SequencedHashMap so they have
> wrap methods and so they extend ProxyMap?
>
> I'd prefer to rename them then too. This however causes obvious
> deprecation issues. It seems that I should deprecate the current HashMap
> versions and create new ones.
>
> Any preferences?
>
> Hen
>
>
> ---------------------------------------------------------------------
> 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