Generics
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/trunk@1024102 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
95e20438a0
commit
db079b02f6
|
@ -70,11 +70,11 @@ public class TransformedSet<E> extends TransformedCollection<E> implements Set<E
|
|||
* @throws IllegalArgumentException if set or transformer is null
|
||||
* @since Commons Collections 3.3
|
||||
*/
|
||||
// TODO: Generics
|
||||
public static Set decorateTransform(Set set, Transformer transformer) {
|
||||
TransformedSet decorated = new TransformedSet(set, transformer);
|
||||
public static <E> Set<E> decorateTransform(Set<E> set, Transformer<? super E, ? extends E> transformer) {
|
||||
TransformedSet<E> decorated = new TransformedSet<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]));
|
||||
|
|
Loading…
Reference in New Issue