Code completion is now a must for each and every IDE. But are you using all its power in IntelliJ IDEA? Check out the tricks below to get the answer.
Complete variables names
How often do you need to declare something like ArrayList list? Using Ctrl + Space you can complete the name of the variable. In this example, you will be suggested to choose between arrayList and list names.
Probably, you already used â€œCamelHumpâ€ for navigation and search. But it works for code completion too. Everything you typed in the editor will be replaced with the relevant code.
For example, you have the following expression:
And then you decided that this should be the minimum size. The fastest way to change this code in IntelliJ IDEA is to place the caret after the dot, then press Ctrl + Space. Find the setMinimumSize() method (donâ€™t forget about â€œCamelHumpâ€!), and press Tab.
The setPreferredSize() method will be replaced with the setMinimumSize(). Donâ€™t worry about your parameters â€“ they will stay where they are.
There are more tricks in IntelliJ IDEA related to completion (such as smart completion) that will be described in the future blog posts. But if you donâ€™t want to wait, check out the Productivity Guide in IntelliJ IDEA or see description of java code assistance features.
Note This tip&trick was originally posted at www.javalobby.org.