[jira] [Commented] (COLLECTIONS-430) Create static factory methods for concrete data structure impls in the corresponding Utils classes

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (COLLECTIONS-430) Create static factory methods for concrete data structure impls in the corresponding Utils classes

Walter Laan (Jira)

    [ https://issues.apache.org/jira/browse/COLLECTIONS-430?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13604971#comment-13604971 ]

Benedikt Ritter commented on COLLECTIONS-430:
---------------------------------------------

To be honest, I don't see why it is more tedious to write {{new DualHashBidiMap<String, String>()}} instead of {{MapUtils.newHashBidiMap()}}.
It spares you 12 characters. Factory methods make sense when several constructors would have the same number of parameters of even the same signatures. In this case a factory method does not add much, IMHO. Beside that, people are used to use the default constructor when creating collections (and maps), because this is how the java collections framework works.
               

> Create static factory methods for concrete data structure impls in the corresponding Utils classes
> --------------------------------------------------------------------------------------------------
>
>                 Key: COLLECTIONS-430
>                 URL: https://issues.apache.org/jira/browse/COLLECTIONS-430
>             Project: Commons Collections
>          Issue Type: Improvement
>    Affects Versions: 4.0
>            Reporter: Thomas Neidhart
>             Fix For: 4.0
>
>
> It is quite tedious to write code like this:
> {noformat}
>   BidiMap<String, String> map = new DualHashBidiMap<String, String>();
> {noformat}
> a more convenient way would be to take advantage from type inference like this:
> {noformat}
>   BidiMap<String, String> map = MapUtils.newHashBidiMap();
> {noformat}
> This would apply basically for all data structures that are available in CC atm.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira