git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/trunk@1024103 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sebastian Bazley 2010-10-19 03:37:19 +00:00
parent db079b02f6
commit 6a849937f5
1 changed files with 4 additions and 4 deletions

View File

@ -70,11 +70,11 @@ public class TransformedSortedSet<E> extends TransformedSet<E> implements Sorted
* @throws IllegalArgumentException if set or transformer is null
* @since Commons Collections 3.3
*/
// TODO: Generics
public static SortedSet decorateTransform(SortedSet set, Transformer transformer) {
TransformedSortedSet decorated = new TransformedSortedSet(set, transformer);
public static <E> SortedSet<E> decorateTransform(SortedSet<E> set, Transformer<? super E, ? extends E> transformer) {
TransformedSortedSet<E> decorated = new TransformedSortedSet<E>(set, transformer);
if (transformer != null && set != null && set.size() > 0) {
Object[] values = set.toArray();
@SuppressWarnings("unchecked") // set is type E
E[] values = (E[]) set.toArray();
set.clear();
for(int i=0; i<values.length; i++) {
decorated.decorated().add(transformer.transform(values[i]));