Extract lambda parameter
Refactor | Extract/Introduce | Lambda Parameter
The Extract Lambda Parameter refactoring helps you extract an expression or statement into a new parameter with a lambda expression passed as a corresponding argument. For example, this could be a comparator passed to a sorting function.
The following demo illustrates the usage of the Extract Lambda Parameter refactoring, as well as Extract Function, Extract Parameter, and Live Templates:
Select a code fragment that you want to extract into a lambda parameter.
Call Refactor | Lambda Parameter from the main menu or select Lambda Parameter from the Refactor This (CtrlAltShift0T) popup.
In the dialog that opens, specify the name, return type, and declaration placement for the new lambda parameter:
Review the changes in the Signature Preview field and click Extract when ready.
Thanks for your feedback!