Extended method reference - A proposal
Mahdi Mohammadi
mahdix at gmail.com
Tue May 17 19:45:49 UTC 2022
Exactly! This is a shortcut or syntax sugar to use a notation similar to a
method reference but with some pre-specified arguments.
So, I can write: `process(x -> obj.find(x, 10))` to call "process" function
with a lambda that accepts a single argument but delegates the job to
"find" function with the same argument and "10" as the second argument.
Instead, I propose we should be able to write `process(obj::find(_,10))`.
Basically, compiler can translate this to a normal lambda-style definition
behind the scene, but for the coder, it makes writing and reading the code
easier.
On Tue, May 17, 2022 at 1:07 PM Julian Waters <tanksherman27 at gmail.com>
wrote:
> Hey Mahdi,
>
> I don't quite understand what you mean, is this a more concise way to
> write Lambdas? (I will say I'm very interested in anything that promotes
> functional code in Java, but it's not very clear to me how this change
> might help- Maybe you could elaborate slightly more?)
>
> best regards,
> Julian
>
More information about the amber-dev
mailing list