News for hackers. Stuff that matters.
Re:"..best direction for evolving Java is to encourage a mor... by extension on Friday August 19, 2011 @08:18AM (#2903082)
Are lambdas always created as SAM types or do they have some other form?

I assume there is some way to specify the SAM type explicitly, for cases where it can't be inferred properly?

Re:"..best direction for evolving Java is to encourage a mor... by jawher on Friday August 19, 2011 @09:53AM (#2903346)
The answer to your first question is yes, a lambda is always assigned to a SAM type.

As to your second question, yes, you can cast a lambda to explicitly specify it's target SAM type:

    obj.method((Runnable)(()=> println("oh hai !")));