L&D series: Intellij IDEA things to help you code easier
Learning and Development chapter 13.
This tutorial can be used on a macOS.
Unused Import
Why we need to import package that we won’t use?
We must checked the Preference
— Editor
— Inspections
— Unused import
first before continue to click Preference
— Editor
— General
— Auto Import
. Then check the Optimize imports on the fly
for Java (I’m using Java here) or Kotlin. It will remove unused import automatically. If it doesn’t work, please re-open the file.
Space
To tidy up spaces, click the file itself or place the cursor in the file then press Command + Alt + L.
Not only we can adjust the space between the code, we can also adjust it like trailing spaces, trailing blank lines at the end of file and also a line break.
Long Line
Set the long line here.
Unused Class/Methods/Fields/Parameters
Click Inspections
— Java
— Declaration redundancy
— Unused declaration
. Then we must run it manually.
The result will be like this.
Quick Peek Method
Put the cursor in MperMperPisang();
then press Alt + Space.
Code Completion
Just press a space, dot or other keys will complete what we type with ease.
If anything is easy, why do you have to do tiring work? — MperMperPisang
Reference