Answer the question
In order to leave comments, you need to log in
How to understand such Java code with lambda?
Kind
There is a fragment, in it it is a lot of CheckedTextView. In fragment
implements View.OnClickListener
checked.setOnClickListener(this::onClick);
or
checked.setOnClickListener(this);
Answer the question
In order to leave comments, you need to log in
The difference is that when used, the
fragment may not implement View.OnClickListener, because the listener is not it, but an anonymous class generated by the lambda. If your fragment still implements View.OnClickListener, then the lambda is completely out of place and redundant.
The difference is that in the first case, an additional anonymous class is created.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question