You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Thomas Neidhart (JIRA)" <ji...@apache.org> on 2013/03/06 20:54:13 UTC
[jira] [Resolved] (COLLECTIONS-372)
ComparatorUtils.transformedComparator wrongly typed (generics)
[ https://issues.apache.org/jira/browse/COLLECTIONS-372?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Thomas Neidhart resolved COLLECTIONS-372.
-----------------------------------------
Resolution: Fixed
Fix Version/s: 4.0
Made change in r1453516.
Makes sense for a TransformingComparator imho, not always possible for other occurrences.
> ComparatorUtils.transformedComparator wrongly typed (generics)
> --------------------------------------------------------------
>
> Key: COLLECTIONS-372
> URL: https://issues.apache.org/jira/browse/COLLECTIONS-372
> Project: Commons Collections
> Issue Type: Bug
> Components: Comparator
> Affects Versions: 4.x
> Environment: n/a
> Reporter: HaveNone
> Priority: Minor
> Labels: patch
> Fix For: 4.0
>
>
> ComparatorUtils.transformedComparator is currently typed as follows :
> {{public static <I,O> Comparator<O> transformedComparator(Comparator<I> comparator, Transformer<I, O> transformer)}}
> It should be typed as follows so that is can be used without removing generics typing:
> {{public static <I,O> Comparator<I> transformedComparator(Comparator<O> comparator, Transformer<I, O> transformer)}}
> Here is a unit test for it :
> Transformer<Integer, String> itosTransformer = TransformerUtils.stringValueTransformer();
> Comparator<Integer> c = new Comparator<Integer>() {
>
> @Override
> public int compare(Integer o1, Integer o2) {
> return o1.compareTo(o2);
> }
> };
> Comparator<String> stringComparator = ComparatorUtils.transformedComparator(c, itosTransformer);
>
> stringComparator.compare("string1", "string2");
--
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