“This is the ninth day of my participation in the First Challenge 2022. For details: First Challenge 2022”

IntelliJ IDEA as a development tool of the dominant this is not controversial, as a Java developer used to this software can not use other (the original version is a little expensive), today to talk about my own use of IntelliJ IDEA in the small functions and skills, not commonly used but very useful skills

1. Debug breakpoints are filtered based on conditions

For example, a for loop goes from 0 to 100, but WHEN I look at it, I just need to look at 30. The general human operation is shown below:

It will press F8 to proceed to the next step. However, a Debug trick in IDEA is to right click on the breakpoint and see the following image:

Pop up the popover shown in label 1, then you can add criteria at label 2 to filter data that does not meet the criteria. The condition shown above indicates that a breakpoint is matched when I equals 30.

Tips: This is just a simple example. The conditions can be set according to your needs. When true, it matches

2. Debug Inserts and prints in real time

If you need to print some columns of data during the development of the Debug program, but the Jar package introduced cannot modify the source code, there is a very useful function in IDEA to solve the problem. The first step is to right-click the place where the data needs to be printed:

Then click Add Inline Watch:

And then confirm. So let me try a new Date

3. Delete useless imported classes with one click

In Java development, there are times when classes are imported into a class, but they are not used. This happens in many classes without good practice. Checking channels one by one is a hassle, even with Ctrl+ Alt + O (Windows, don’t say I don’t have a Mac). We can use the left mouse button to select the project or package to remove unnecessary classes in one click. Then use Ctrl+ Alt + O to clear all of the following files of useless imported classes in one click.

4. Filter the use of classes

Select a class while reading the source code and Ctrl+ left – click a popup box showing which classes the class is referenced in

There are a lot of things we don’t want to see used here, including test classes and so on. You can filter your needs by selecting the drop-down