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

View File

@ -70,11 +70,11 @@ public class TransformedSet<E> extends TransformedCollection<E> implements Set<E
* @throws IllegalArgumentException if set or transformer is null * @throws IllegalArgumentException if set or transformer is null
* @since Commons Collections 3.3 * @since Commons Collections 3.3
*/ */
// TODO: Generics public static <E> Set<E> decorateTransform(Set<E> set, Transformer<? super E, ? extends E> transformer) {
public static Set decorateTransform(Set set, Transformer transformer) { TransformedSet<E> decorated = new TransformedSet<E>(set, transformer);
TransformedSet decorated = new TransformedSet(set, transformer);
if (transformer != null && set != null && set.size() > 0) { 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(); set.clear();
for(int i=0; i<values.length; i++) { for(int i=0; i<values.length; i++) {
decorated.decorated().add(transformer.transform(values[i])); decorated.decorated().add(transformer.transform(values[i]));