[biojava-dev] a bit offtopic: javac 1.5 & generics

Thomas Down thomas at derkholm.net
Fri Feb 6 07:16:40 EST 2004


Once upon a time, Michael Heuer wrote:
> 
> Guess I should have read this paper before I began
> 
> Adding Wildcards to the Java Programming Language
> > http://www.bracha.org/wildcards.pdf
> 
> 
> but in short, this works
> 
>  Set<Foo> foos = new HashSet<Foo>();
> 
>  Set<Foo> unmodifiableFoos = (Set<Foo>) Collections.unmodifiableSet(foos);
> 
> and this does not
> 
>  Set<Foo> emptyFoos = (Set<Foo>) Collections.EMPTY_SET;

No, that doesn't work :-(.

You can, however, do:

   Set<Foo> emptyFoos = Collections.emptySet();

Better than nothing, anyway.

    Thomas.


More information about the biojava-dev mailing list