Hello friends,
In Eclipse (3.4+ upwards), I was searching for shortcut which converts the if {} else {}
condition block to the java ternary operator[or the ?: operator ]
can you guide me, how to do i do this ?
Thank you!
Hello friends,
In Eclipse (3.4+ upwards), I was searching for shortcut which converts the if {} else {}
condition block to the java ternary operator[or the ?: operator ]
can you guide me, how to do i do this ?
Thank you!
There is no such shortcut. Refactoring statements into expressions isn't a trivial process, and isn't always possible to begin with. The process would be too complicated to be automated.
That said, Ctrl
+Shift
+L
will list ALL Eclipse shortcuts.
Well, you could add a Template to Eclipse like this:
${condition:field(boolean)}? ${positive:field(void)}: ${negative:field(void)};
Name it something like tern
and you can have it auto-create the ternary operator for you.
(Not sure if this is what you want)