cast at call site problem

Paul Benedict pbenedict at apache.org
Mon Apr 1 07:51:07 PDT 2013


I believe you want to write this:
foo(Collections.<String>emptySet());


On Mon, Apr 1, 2013 at 9:48 AM, Anna Kozlova <Anna.Kozlova at jetbrains.com>wrote:

> Hello all,
>
> Is it a bug or is it an intentional behavior:
> This code compiles
> {code}
>     void foo(Set<String> s) {}
>
>     void bar() {
>         foo(Collections.emptySet());
>     }
> {code}
>
> but this code doesn't:
> {code}
>     void foo(Set<String> s) {}
>
>     void bar() {
>         foo((Set<String>)Collections.emptySet());
>     }
> {code}
>
> Lambda build 83.
>
> Thanks
> Anna
>
>
>
>


More information about the lambda-dev mailing list