Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse: Selectively convert to lambda expression

I can configure Eclipse's code "Clean Up" to convert existing code expressions to lamba expressions if possible.

enter image description here

I am trying to find a way to manually trigger this, if possible only for the selected subset of my type.

I do not want to run the complete code cleanup, only the conversion to lambda expressions, and, if possible, also not for the complete type, but only for the selected part of it.

like image 857
kerner1000 Avatar asked Dec 24 '22 16:12

kerner1000


1 Answers

Clean-ups are intended for mass operations. Since you don't seem to be interested in mass operation, you could consider using quick assist (Ctrl+1) on individual expressions.

EDIT: The quick assist is available since Eclipse Luna, see http://help.eclipse.org/luna/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2FwhatsNew%2Fjdt_whatsnew.html - second entry "Migrate anonymous class creations to lambda expressions and back".

Or: run the cleanup on a given file and the use the compare editor (against latest from git or similar) to only accept some selected changes.

like image 50
Stephan Herrmann Avatar answered Jan 14 '23 10:01

Stephan Herrmann