[
https://issues.apache.org/jira/browse/COLLECTIONS-711?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17000246#comment-17000246
]
David Mollitor commented on COLLECTIONS-711:
--------------------------------------------
Makes sense to me. Nice write up.
V, it would be great if you could accomplish this.
G, I saw an implementation of this feature somewhere else a while ago and they
had something like:
{code:java}
if (arg instanceof java.util.AbstractList) {
return arg;
}
{code}
So, basically, if the thing being passed in is a JDK list, just return it as
is. I think this is a useful optimization. So you're right that it shouldn't
be wrapped within the method itself, but do not always perform a copy.
> Add Utility to Convert Collection to List
> -----------------------------------------
>
> Key: COLLECTIONS-711
> URL: https://issues.apache.org/jira/browse/COLLECTIONS-711
> Project: Commons Collections
> Issue Type: Improvement
> Components: Collection, List
> Reporter: David Mollitor
> Priority: Major
>
> Please take a look at:
>
> [https://stackoverflow.com/questions/580160/how-to-convert-a-collection-to-list]
>
> Add a utility method to convert a {{Collection}} to a {{List}}, returning the
> argument if it is a {{List}} subclass itself. Make the return type
> Unmodified for consistency.since if the data comes in as a non-List class,
> then a copy is made, so modifying the returned collection would not affect
> the original source, whereas if a {{List}} is passed in, modification to the
> returned List would impact the original source.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)