What does it mean that a Listener can be replaced with lambda?

It means that you can shorten up your code.

An example of onClickListener() without lambda:

mButton.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        // do something here
    }
});

can be rewritten with lambda:

mButton.setOnClickListener((View v) -> {
    // do something here
});

It’s the same code. This is useful when using a lot of listeners or when writing code without an IDE.
For more info, check this.

Hope this answers your question.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)