IDEA Code Refactoring Tips (VIP Collection Edition)

content

1. Refactoring function

1. Extraction method

2. Merge method

3. Method renaming

4. Function parameter position change and renaming

 2. Refactoring variables

 3. Extract the method to the parent class


1. Refactoring function

1. Extraction method

Extract the desired code, press the shortcut key Ctrl+Alt+M, a box will pop up, write the method name to extract a method

 

2. Merge method

Reverse operation, after selecting the method, directly merge the method code into the main method

3. Method renaming

Ctrl+Shift+Alt+T, or Shift+F6

 

4. Function parameter position change and renaming

 2. Refactoring variables

Ctrl+Alt+C 快速提取常量(Constant)

Ctrl+Alt+V快速提取变量(Variable)

Ctrl+Alt+F快速提取成员变量(Filed Variable)

Ctrl+Shift+f6 重构变量的类型

点击变量,直接使用快捷键

 

 3. Extract the method to the parent class

Useful, please like and develop good habits!

If you have any questions, please leave a message!

 

Guess you like

Origin blog.csdn.net/libusi001/article/details/124310564