--- On Thu, 10/16/08, Jonathan Cast <[EMAIL PROTECTED]> wrote:

> Can I have HashSet<Integer>?  Could I construct
> HashSet<?>, if I did?

Yes:

HashSet<?> blah = (HashSet<?>) hashSetClass.newInstance();

... compiles, and won't throw an exception if hashSetClass truly is the class 
object for HashSet.  Pretty useless, because you can't put anything *into* a 
HashSet<?> object...

blah.add("foo"); // doesn't typecheck...

but you can do:
HashSet<String> blah = (HashSet<String>) hashSetClass.newInstance();
blah.add("foo");

works fine..




      
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to