Reputation: 122
Suppose I have an object of class RandomClass with a method doStuff() which returns an int.
I'd like to do something like this:
myObject.doStuff()
Right now I do that by first typing myObject.doStuff()
, use Alt+enter to popup the "Introduce local variable" menu and then use that.
Can I do that faster ?
Thanks.
Upvotes: 2
Views: 340
Reputation: 48045
You can type myObject.doStuff()
and then press Ctrl+Alt+V to immediately create the local variable. You will directly bypass the pop-up and that is really all you gain.
You can simplify the key mapping to reduce the number of keys to press for the Extract Variable
if it is really necessary.
Upvotes: 2
Reputation: 40378
Generally, no, that's the quickest way to do it.
Given that the doStuff
method already exists, I could do what you described with 6 keypresses in about a second and a half. That's pretty quick, I would think...
On the other hand, if it's boilerplate code that you'll be typing over and over, you could consider making a custom Live Template - hit ctrl-j and type something like sout
or psvm
to see some examples...
Good luck!
Upvotes: 1