Autocomplete left side of the equation

Answered

Consider, I have a method

private List<String> getListOfStrings(){

}

 

Is there a way for me to type in 

getListOfStrings();

Enter a shortcut and Intellij to autocomplete by adding 'List<String> listStrings = ':

List<String> listStrings = getListOfStrings();

0
1 comment

Hello,

In case you have static method like:

private static List<String> getListOfStrings(){
return null;
}

And it's usage is as follows:

public static void main(String[] args) {
getListOfStrings();
}

You may put the caret on "getListOfStrings();" and press Cmd+Alt+V (or Refactor | Extract | Variable) so the variable will be extracted as:

List<String> listOfStrings = getListOfStrings();
1

Please sign in to leave a comment.