Why cannot I write "Map<String,String> m = (Map<>)obj"?
Alex Lam S.L.
alexlamsl at gmail.com
Wed Jul 25 02:55:32 PDT 2012
For these type of unchecked casting situation, I'd normally just do:
@SupressWarnings("unchecked")
Map<String, String> m = (Map) obj;
Alex.
On Wed, Jul 25, 2012 at 10:11 AM, Weijun Wang <weijun.wang at oracle.com> wrote:
> Just curious, if obj is of type Object, and I want to cast it to
> Map<String,String>, why cannot I use the diamond operator?
>
> Thanks
> Max
More information about the compiler-dev
mailing list