[
https://issues.apache.org/jira/browse/COLLECTIONS-243?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12480180
]
Stephen Kestle commented on COLLECTIONS-243:
--------------------------------------------
Ok - interesting problem. The contract makes things difficult. Solutions are:
* Have 2 transformers - one for symmetric transformation (<E, E>), and one for
asymmetric (<O, E>). Add transformedAdd(O) and
transformedAddAll(Collection<O>).
I would do this by creating an interface that adds all these methods, so that
we don't have to return class types.
* Widen the scope of the transformer - I believe it should be Transformer<?
super E, ? extends E> or something like that.
Actually, I reckon both of these should be done.
> generic versions of some more classes
> -------------------------------------
>
> Key: COLLECTIONS-243
> URL: https://issues.apache.org/jira/browse/COLLECTIONS-243
> Project: Commons Collections
> Issue Type: Improvement
> Components: Collection
> Affects Versions: Generics
> Environment: OS X
> Reporter: Edwin Tellman
> Priority: Minor
> Fix For: Generics
>
> Attachments: collections_06_03_11.patch
>
>
> I added generics to some more classes and fixed some compilation problems.
> The generic version of Transformer required the input and output types to be
> identical. This seemed to me to reduce the usefulness of transformed
> collections, as transforming one type into another seems like it would be a
> fairly common operation. I'm not sure how to fix this, however, as it also
> doesn't seem feasible to have a generic TransformedCollection with different
> input and output types that implements Collection<E>. Anyway, this patch
> de-generifies TransformedCollection, which also fixes some compilation
> problems. Please disregard this change if you disagree and have a better
> solution.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]