You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Stephen Colebourne (JIRA)" <ji...@apache.org> on 2007/08/17 14:48:35 UTC

[jira] Commented: (COLLECTIONS-256) ListUtils.transformedList(list, transformer) doesn't transform

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

Stephen Colebourne commented on COLLECTIONS-256:
------------------------------------------------

I think we added another similar factory method to get around this issue IIRC.

> ListUtils.transformedList(list, transformer) doesn't transform
> --------------------------------------------------------------
>
>                 Key: COLLECTIONS-256
>                 URL: https://issues.apache.org/jira/browse/COLLECTIONS-256
>             Project: Commons Collections
>          Issue Type: Bug
>          Components: List
>    Affects Versions: 3.2
>         Environment: Java 1.5
>            Reporter: Kurtis Williams
>            Assignee: Henri Yandell
>             Fix For: 3.3
>
>
> The static method ListUtils.transformedList(List list, Transformer trans) does not apply the transformer before returning the list.  I've traced into the code and it falls all the way through to the TransformedCollection constructor which has documentation that states that items existing in the list are NOT transformed.  This yields bizarre unexpected behavior for this method.
> Conversely, the ListUtils.predicatedList(List list, Predicate pred) DOES apply the predicate.  These methods are very similar but behave inconsistently.
> If the transformer is not applied to the list, the method's usefulness is somewhat limited and causes the user to create an extra unwanted list in some circumstances:
> // To transform an existing list
> List myList = ... some list to be transformed ...
> List transformed = ListUtils.transformedList(new ArrayList(), myTransformer);
> transformed.addAll(myList);
> I would expect a much shorter implementation such as:
> List transformed = ListUtils.transformedList(myList, myTransformer)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.