IntelliJ IDEA使用指南
1.代码模板
package com.test;
import java.util.ArrayList;
import java.util.Arrays;
public class Templates {
private static final String a="aaa";
public static final String b="bbb";
public static final int c=1;
public static final String d="ddd";
public static void main(String[] args) {
System.out.println("hello");
System.out.println("args = " + Arrays.deepToString(args));
System.out.println("Templates.main");
System.out.println("args = " + args);
System.out.println(args);
String []arr=new String[]{"A","B","c"};
for (int i = 0; i < arr.length ; i++) {
}
for (String s : arr) {
}
for (int i = 0; i < arr.length; i++) {
String s = arr[i];
}
ArrayList<String> list = new ArrayList<>();
for (String s : list) {
}
for (int i = 0; i < list.size(); i++) {
}
for (int i = list.size() - 1; i >= 0; i--) {
System.out.println("倒叙遍历");
}
}
public void method(){
ArrayList<String> list = new ArrayList<>();
if (list == null) {
}
if (list != null) {
}
if (list != null) {
}
if (list == null) {
}
}
}
2.自定义代码模板
(1)自动生成无返回值方法
pvoid
public void $VAR1$() {
$VAR2$
}
(2)自定生成返回值是Map的方法
pmap
public Map $VAR1$() {
Map map = new HashMap();
$VAR2$
return map;
}
(3)自动生成private static final string
prsfs
private static final String $VAR1$ = $VAR2$;
$END$
(4)自动生成private static final int
prsfi
private static final int $VAR1$ = $VAR2$;
$END$
|