Stream.flatMap reference ambiguity
Dan Smith
daniel.smith at oracle.com
Wed Feb 27 11:11:32 PST 2013
On Feb 26, 2013, at 5:42 PM, Zhong Yu <zhong.j.yu at gmail.com> wrote:
> What I'm confused about is that the sentence sounds like it's ok to
> overload with functional interfaces that have _same_ parameter types.
> Or is that just outright nonsense? So did you simply mean "no overload
> with functional interfaces of the same arity"?
Same parameter types, different returns. See, for example, Stream.map. The overload resolution logic is able to disambiguate based on what gets returned. (That's a much easier problem that trying to choose the best types for lambda parameters based on an arbitrary block of code.)
—Dan
More information about the lambda-dev
mailing list