IntelliJ IDEA 快捷键 1|0if 2|0else 3|0for / iter 4|0fori 5|0new 6|0nn / notnull 7|0! / not 8|0null 9|0return 10|0sout 11|0try 12|0twr 13|0while

摘自:https://www.cnblogs.com/wupeixuan/p/12154533.html

IntelliJ IDEA 在 2013.1 版本后就出现了后缀代码自动补全的新功能。现在,我很高兴的介绍后缀代码自动补全(Postfix Code Completion),这是一类新的代码补全方式,希望它能提高你的编程效率。

本文使用的 IDEA 版本为 2019.3,首先如果想要查看所有的后缀自动补全模板或进行设置,可以点击 Settings... -> Editor -> General -> Postfix Completion 进入,打开后显示如下:

IntelliJ IDEA 快捷键
1|0if
2|0else
3|0for / iter
4|0fori
5|0new
6|0nn / notnull
7|0! / not
8|0null
9|0return
10|0sout
11|0try
12|0twr
13|0while

注:后缀提示已经结合成为基本提示的一部分,因此你不需要在代码上下文查找所有可用的后缀补全列表,只需要使用 CTRL+J 快捷键即可。

IntelliJ IDEA 快捷键
1|0if
2|0else
3|0for / iter
4|0fori
5|0new
6|0nn / notnull
7|0! / not
8|0null
9|0return
10|0sout
11|0try
12|0twr
13|0while

IDEA 的后缀代码自动补全功能能够在你编程时减少光标向后跳跃,它能够让你基于你添加的后缀、表达式类型和当前语镜把一个表达式转换成另一个。

接下来列举几个常用的来给大家示范一下:


使用 if 检查布尔表达式是否为 true。

IntelliJ IDEA 快捷键
1|0if
2|0else
3|0for / iter
4|0fori
5|0new
6|0nn / notnull
7|0! / not
8|0null
9|0return
10|0sout
11|0try
12|0twr
13|0while

else


使用 else 可以检查布尔表达式为是否为 false。

IntelliJ IDEA 快捷键
1|0if
2|0else
3|0for / iter
4|0fori
5|0new
6|0nn / notnull
7|0! / not
8|0null
9|0return
10|0sout
11|0try
12|0twr
13|0while

for / iter


遍历集合。

IntelliJ IDEA 快捷键
1|0if
2|0else
3|0for / iter
4|0fori
5|0new
6|0nn / notnull
7|0! / not
8|0null
9|0return
10|0sout
11|0try
12|0twr
13|0while

fori


用索引遍历集合进行迭代。

IntelliJ IDEA 快捷键
1|0if
2|0else
3|0for / iter
4|0fori
5|0new
6|0nn / notnull
7|0! / not
8|0null
9|0return
10|0sout
11|0try
12|0twr
13|0while

new


为该类新建一个对象。

IntelliJ IDEA 快捷键
1|0if
2|0else
3|0for / iter
4|0fori
5|0new
6|0nn / notnull
7|0! / not
8|0null
9|0return
10|0sout
11|0try
12|0twr
13|0while

nn / notnull


检查表达式是否为非空。

IntelliJ IDEA 快捷键
1|0if
2|0else
3|0for / iter
4|0fori
5|0new
6|0nn / notnull
7|0! / not
8|0null
9|0return
10|0sout
11|0try
12|0twr
13|0while

! / not


取反。

IntelliJ IDEA 快捷键
1|0if
2|0else
3|0for / iter
4|0fori
5|0new
6|0nn / notnull
7|0! / not
8|0null
9|0return
10|0sout
11|0try
12|0twr
13|0while

null


检查表达式是否为空。

IntelliJ IDEA 快捷键
1|0if
2|0else
3|0for / iter
4|0fori
5|0new
6|0nn / notnull
7|0! / not
8|0null
9|0return
10|0sout
11|0try
12|0twr
13|0while

return


返回值。

IntelliJ IDEA 快捷键
1|0if
2|0else
3|0for / iter
4|0fori
5|0new
6|0nn / notnull
7|0! / not
8|0null
9|0return
10|0sout
11|0try
12|0twr
13|0while

sout


输出。

IntelliJ IDEA 快捷键
1|0if
2|0else
3|0for / iter
4|0fori
5|0new
6|0nn / notnull
7|0! / not
8|0null
9|0return
10|0sout
11|0try
12|0twr
13|0while

try


在 try-catch 块中插入语句。

IntelliJ IDEA 快捷键
1|0if
2|0else
3|0for / iter
4|0fori
5|0new
6|0nn / notnull
7|0! / not
8|0null
9|0return
10|0sout
11|0try
12|0twr
13|0while

twr


在 try-with-resources 块中插入语句(需要 Java 7 或更高版本)。

IntelliJ IDEA 快捷键
1|0if
2|0else
3|0for / iter
4|0fori
5|0new
6|0nn / notnull
7|0! / not
8|0null
9|0return
10|0sout
11|0try
12|0twr
13|0while

while


布尔语句为 true 时进行循环。

IntelliJ IDEA 快捷键
1|0if
2|0else
3|0for / iter
4|0fori
5|0new
6|0nn / notnull
7|0! / not
8|0null
9|0return
10|0sout
11|0try
12|0twr
13|0while

还有一些后缀名没有一一列出,大家可以自己尝试一下,希望 IDEA 的后缀补全功能能对你的编程效率有所提升。


__EOF__

IntelliJ IDEA 快捷键
1|0if
2|0else
3|0for / iter
4|0fori
5|0new
6|0nn / notnull
7|0! / not
8|0null
9|0return
10|0sout
11|0try
12|0twr
13|0while
作  者:武培轩
出  处:https://www.cnblogs.com/wupeixuan
关于博主:敲代码,健身,读书。
版权声明:本文为博主原创文章,转载请注明出处。
声援博主:如果您觉得文章对您有帮助,可以点击文章右下角推荐】一下。您的鼓励是博主的最大动力!
 
 
Java

IntelliJ IDEA 在 2013.1 版本后就出现了后缀代码自动补全的新功能。现在,我很高兴的介绍后缀代码自动补全(Postfix Code Completion),这是一类新的代码补全方式,希望它能提高你的编程效率。

本文使用的 IDEA 版本为 2019.3,首先如果想要查看所有的后缀自动补全模板或进行设置,可以点击 Settings... -> Editor -> General -> Postfix Completion 进入,打开后显示如下:

IntelliJ IDEA 快捷键
1|0if
2|0else
3|0for / iter
4|0fori
5|0new
6|0nn / notnull
7|0! / not
8|0null
9|0return
10|0sout
11|0try
12|0twr
13|0while

注:后缀提示已经结合成为基本提示的一部分,因此你不需要在代码上下文查找所有可用的后缀补全列表,只需要使用 CTRL+J 快捷键即可。

IntelliJ IDEA 快捷键
1|0if
2|0else
3|0for / iter
4|0fori
5|0new
6|0nn / notnull
7|0! / not
8|0null
9|0return
10|0sout
11|0try
12|0twr
13|0while

IDEA 的后缀代码自动补全功能能够在你编程时减少光标向后跳跃,它能够让你基于你添加的后缀、表达式类型和当前语镜把一个表达式转换成另一个。

接下来列举几个常用的来给大家示范一下:


使用 if 检查布尔表达式是否为 true。

IntelliJ IDEA 快捷键
1|0if
2|0else
3|0for / iter
4|0fori
5|0new
6|0nn / notnull
7|0! / not
8|0null
9|0return
10|0sout
11|0try
12|0twr
13|0while

else


使用 else 可以检查布尔表达式为是否为 false。

IntelliJ IDEA 快捷键
1|0if
2|0else
3|0for / iter
4|0fori
5|0new
6|0nn / notnull
7|0! / not
8|0null
9|0return
10|0sout
11|0try
12|0twr
13|0while

for / iter


遍历集合。

IntelliJ IDEA 快捷键
1|0if
2|0else
3|0for / iter
4|0fori
5|0new
6|0nn / notnull
7|0! / not
8|0null
9|0return
10|0sout
11|0try
12|0twr
13|0while

fori


用索引遍历集合进行迭代。

IntelliJ IDEA 快捷键
1|0if
2|0else
3|0for / iter
4|0fori
5|0new
6|0nn / notnull
7|0! / not
8|0null
9|0return
10|0sout
11|0try
12|0twr
13|0while

new


为该类新建一个对象。

IntelliJ IDEA 快捷键
1|0if
2|0else
3|0for / iter
4|0fori
5|0new
6|0nn / notnull
7|0! / not
8|0null
9|0return
10|0sout
11|0try
12|0twr
13|0while

nn / notnull


检查表达式是否为非空。

IntelliJ IDEA 快捷键
1|0if
2|0else
3|0for / iter
4|0fori
5|0new
6|0nn / notnull
7|0! / not
8|0null
9|0return
10|0sout
11|0try
12|0twr
13|0while

! / not


取反。

IntelliJ IDEA 快捷键
1|0if
2|0else
3|0for / iter
4|0fori
5|0new
6|0nn / notnull
7|0! / not
8|0null
9|0return
10|0sout
11|0try
12|0twr
13|0while

null


检查表达式是否为空。

IntelliJ IDEA 快捷键
1|0if
2|0else
3|0for / iter
4|0fori
5|0new
6|0nn / notnull
7|0! / not
8|0null
9|0return
10|0sout
11|0try
12|0twr
13|0while

return


返回值。

IntelliJ IDEA 快捷键
1|0if
2|0else
3|0for / iter
4|0fori
5|0new
6|0nn / notnull
7|0! / not
8|0null
9|0return
10|0sout
11|0try
12|0twr
13|0while

sout


输出。

IntelliJ IDEA 快捷键
1|0if
2|0else
3|0for / iter
4|0fori
5|0new
6|0nn / notnull
7|0! / not
8|0null
9|0return
10|0sout
11|0try
12|0twr
13|0while

try


在 try-catch 块中插入语句。

IntelliJ IDEA 快捷键
1|0if
2|0else
3|0for / iter
4|0fori
5|0new
6|0nn / notnull
7|0! / not
8|0null
9|0return
10|0sout
11|0try
12|0twr
13|0while

twr


在 try-with-resources 块中插入语句(需要 Java 7 或更高版本)。

IntelliJ IDEA 快捷键
1|0if
2|0else
3|0for / iter
4|0fori
5|0new
6|0nn / notnull
7|0! / not
8|0null
9|0return
10|0sout
11|0try
12|0twr
13|0while

while


布尔语句为 true 时进行循环。

IntelliJ IDEA 快捷键
1|0if
2|0else
3|0for / iter
4|0fori
5|0new
6|0nn / notnull
7|0! / not
8|0null
9|0return
10|0sout
11|0try
12|0twr
13|0while

还有一些后缀名没有一一列出,大家可以自己尝试一下,希望 IDEA 的后缀补全功能能对你的编程效率有所提升。


__EOF__

IntelliJ IDEA 快捷键
1|0if
2|0else
3|0for / iter
4|0fori
5|0new
6|0nn / notnull
7|0! / not
8|0null
9|0return
10|0sout
11|0try
12|0twr
13|0while
作  者:武培轩
出  处:https://www.cnblogs.com/wupeixuan
关于博主:敲代码,健身,读书。
版权声明:本文为博主原创文章,转载请注明出处。
声援博主:如果您觉得文章对您有帮助,可以点击文章右下角推荐】一下。您的鼓励是博主的最大动力!