Find and Replace Code Duplicates
The Find and Replace Code Duplicates action lets you find code repetitions similar to the selected method or constant field, and replace them with calls to the original method or constant. It also lets you specify a scope for your search.
Position the cursor within the method or a constant field whose duplicates you want to search for.
From the main or context menu, select Refactor | Find and Replace Code Duplicates.
In the dialog that opens, select the scope where IntelliJ IDEA shall look for code duplicates.
For each found code duplicate, IntelliJ IDEA will prompt you to confirm the replacement.