--- 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
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe
- Re: [Haskell-cafe] Re: What I wish someone had told me..... Jonathan Cast
- Re: [Haskell-cafe] Re: What I wish someone had told... Daryoush Mehrtash
- Re: [Haskell-cafe] Re: What I wish someone had told... Stefan Monnier
- Re[2]: [Haskell-cafe] Re: What I wish someone had told m... Bulat Ziganshin
- Re: Re[2]: [Haskell-cafe] Re: What I wish someone h... Daryoush Mehrtash
- Re: Re[2]: [Haskell-cafe] Re: What I wish someone h... Jonathan Cast
- Re: Re[2]: [Haskell-cafe] Re: What I wish someone h... Richard O'Keefe
- Re: Re[2]: [Haskell-cafe] Re: What I wish someone h... Jonathan Cast
- Re: Re[2]: [Haskell-cafe] Re: What I wish someone h... Robert Greayer
- Re: Re[2]: [Haskell-cafe] Re: What I wish someone h... Jonathan Cast
- Re: Re[2]: [Haskell-cafe] Re: What I wish someone h... Robert Greayer
- Re: Re[2]: [Haskell-cafe] Re: What I wish someone h... Jonathan Cast
- Re: Re[2]: [Haskell-cafe] Re: What I wish someone h... Robert Greayer
- Re: Re[2]: [Haskell-cafe] Re: What I wish someone h... Jonathan Cast
- Re: Re[2]: [Haskell-cafe] Re: What I wish someone h... Robert Greayer
- Re: Re[2]: [Haskell-cafe] Re: What I wish someone h... Jonathan Cast
- Re: Re[2]: [Haskell-cafe] Re: What I wish someone h... Daryoush Mehrtash
- Re: Re[2]: [Haskell-cafe] Re: What I wish someone h... Derek Elkins
- Re: Re[2]: [Haskell-cafe] Re: What I wish someone h... Don Stewart
- Re: Re[2]: [Haskell-cafe] Re: What I wish someone h... Jonathan Cast
- Re: [Haskell-cafe] Re: What I wish someone had told... Paul Johnson
