IntelliJ Shortcut Windows
IntelliJ Shortcut for the cool kids using Windows
Here are some useful shortcuts.
Easy and common
Code completion/Going to next line in the middle of code line
ctrl+ shift + enter
Normally to go to next line in the middle of code, you do right arrow + enter but use this shortcut above
See method’s parameters
ctrl + p
Static import completion
alt + enter
For example, hide Assertions by importing it and can use its methods right away instead of Assertions.assertThat
Making test case
ctrl + shift + t
Click on that class you want to test and use this shortcut instead of creating package in test folder
Going back to what you were previously working on
ctrl + e
Extract variable or method
ctrl + alt + v for variable ctrl + alt + v for method
Implementing methods of interface
ctrl + i
Select methods to override/implement or see what methods are available
ctrl + o
See where method is declared
ctrl + b or ctrl + mouse left click
See implementation of method
ctrl + alt + b
Refactoring with Lambda
alt + enter
Choose inline variable
alt + shift + enter
inline variable (for refactoring)
Ctrl + alt + n
like int count = something.getCount() , return count => return something.getCount();
Generate things like getter, constructor
alt + insert
Create public static void main
psvm
For System.out.println(variable) use soutv or soutm to print method
Go to red underlined error
Windows + f2
copy and paste in 1 command
ctrl + d
search
shift twice
See file structure
ctrl + f12
print parameters automatically in green
/**
Introduce constant
ctrl + alt + c
Renaming
rename variable when you did copy and paste or class
shift + f6
When we copy test cases or some duplicate code and we just need to change the variable name from like member1 to member2
works for class too
rename variable in 1 file
ctrl + r
rename variable in mutliple files in 1 directory
click on that directory first ctrl + shift + r