commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Torsten Curdt (JIRA)" <>
Subject [jira] Created: (COLLECTIONS-231) Not return the base interface on decorate
Date Mon, 30 Oct 2006 10:45:16 GMT
Not return the base interface on decorate

                 Key: COLLECTIONS-231
             Project: Commons Collections
          Issue Type: Improvement
          Components: Map
    Affects Versions: 3.2
            Reporter: Torsten Curdt

At the moment I don't see a reason why the static "decorate" method does not return ListOrderedMap
but just the base interface OrderedMap.

I want to decorate a Map to be a ListOrderedMap but due to the fact that the constructor is
not visible and decorate only returns the base interface OrderedMap an unnecessary cast is

 ListOrderedMap map = (ListOrderedMap)ListOrderedMap.decorate(new MyMap());

As the decorate method is static and not part of any interface it should be fine to return
the real type instead of the base. Otherwise I'd suggest to make the constructor visible.
From the API POV It is not really understandable why this

 ListOrderedMap map = new ListOrderedMap();

is fine and creates a HashMap under the hood while this

 ListOrderedMap map = new ListOrderedMap(new MyMap()));

is not ok.

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
For more information on JIRA, see:


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message