[
https://issues.apache.org/jira/browse/COLLECTIONS-519?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13985479#comment-13985479
]
Radoslav Paskalev commented on COLLECTIONS-519:
-----------------------------------------------
Exactly, thanks:)
Here is what i mean by decorate or extend the utility functions:
{code} public class ListUtils extends org.apache.commons.collections.ListUtils{
public static boolean isEqualList(final Collection list1, final Collection
list2){
//do something
boolean res = org.apache.commons.collections.ListUtils.isEqualList(list1,
list2);
//do something
return res;
}
}{code}
When i can extend the base class, i can quickly add more functions to ListUtils:
{code} public class ListUtils extends org.apache.commons.collections.ListUtils{
public static List asList(String s1){
List list = new ArrayList();
list.add(s1);
return list;
}
}{code}
And by hide the library implementation i mean that i can hide the fact that we
are using an external library because we import and work only with the
ListUtils from my package. Then when we have to update the external library or
to replace it - i only need to change my custom ListUtils class.
> private constructors in utility classes break existing code
> -----------------------------------------------------------
>
> Key: COLLECTIONS-519
> URL: https://issues.apache.org/jira/browse/COLLECTIONS-519
> Project: Commons Collections
> Issue Type: Bug
> Affects Versions: 4.x
> Reporter: Radoslav Paskalev
>
> Hello,
> In collections version 4.x all utility classes (example ListUtils, MapUtils,
> PredicateUtils....) have private constructors. I consider this to be a
> serious bug, as it breaks any possibility the classes to be extended by the
> users. The javadoc says that constructors are private in order to prevent
> class instantiation but this object instantiation is not really problem and i
> think it is more important to allow classes to be extended. The possibility
> to extend utility classes was one of the major selling points of commons.lang
> and commons.collections projects. In the latest commons.lang project the
> utility classes still have public constructors.
> Best Regards
--
This message was sent by Atlassian JIRA
(v6.2#6252)