Design for collections upgrades

"Zdeněk Troníček" tronicek at fit.cvut.cz
Thu Mar 10 03:18:18 PST 2011


I have not being thinking of it. The first idea is:

            Class<Set> c = (Class<Set>) set.getClass();
            Set<T> newSet = c.newInstance();

Z.
-- 
Zdenek Tronicek
FIT CTU in Prague


Rémi Forax napsal(a):
>   Le 10/03/2011 11:46, "Zdeněk Troníček" a écrit :
>> To me it seems logical that filter() returns the same collection as was
>> the original collection. For Set you do not have any other choice
>> either:
>>
>> set.filter(predicate)
>>
>> cannot switch from HashSet to TreeSet or back.
>>
>> Z.
>
> How do you implement that ?
>
> R.
>
>
>



More information about the lambda-dev mailing list