IDEA has a very awesome function, that is suffix completion (not automatic completion), many people unexpectedly do not know this operation, still manually knocking code. \

This feature can be used to template completion statements using code completion, For example, iterating through loops (for, foreach), wrapping a String with string.format (), wrapping an expression with type conversion, generating if statements from null (not) or other discriminators, generating branch statements with instanceOf, and so on.

It’s as simple as pressing the dot sign. After an expression, and then typing in some prompts or selecting a candidate from a list. Common candidates are shown in GIF below.

Var declaration

2, null

3, notnull is notnull

4

5, for traversal

Fori traversal with index

7

8

9, cast

10, return return value



(after)