1. 通用篇

1.1. 系统输出篇

  • serr

    System.err.println("");
    
  • sout

    System.out.println();
    
  • soutm 可打印当前类的方法名

    public class LiveTemplate {
        public static void main(String[] args) {
            System.out.println("LiveTemplate.main");
        }
    }
    
  • soup 可打印当前方法的所有入参即值

    public static void main(String[] args) {
        System.out.println("args = [" + args + "]");
    }
    
  • soutv 可打印定义的变量值

    public static void main(String[] args) {
        String str = "hello world";
        System.out.println("str = " + str);
    }
    

1.2. 快速迭代器篇

  • fori 快速生成for循环

    for (int i = 0; i < ; i++) {
    
    }
    
  • itli 快速生成for list循环

    for (int i = 0; i < list.size(); i++) {
        Object o =  list.get(i);
    
    }
    
  • itco 使用迭代器循环

    for (Iterator iterator = collection.iterator(); iterator.hasNext(); ) {
      Object next =  iterator.next();
    }
    
  • iten 使用while循环

    while (enumeration.hasMoreElements()) {
        Object nextElement =  enumeration.nextElement();
    }
    
  • iter for循环

    for (String arg : args) {
    }
    

1.3. 快速生成代码块

  • psvm 快速生成main函数

    public static void main(String[] args) {
    
    }
    
  • geti getInstance

    public static LiveTemplate getInstance() {
        return ;
    }
    
  • 'ifn' if null:判断对象是否为空

    if (args == null) {
    
    }
    
  • inn if not null:判断对象不为空

    if (args != null) {
    
    }
    
  • inst instance of:判断是否是某类型的实例

    if (args instanceof Object) {
        Object o = (Object) args;
    
    }
    

1.4. 快速生成修饰符

  • psf public static final

    public static final
    
  • psfi public static final int

    public static final int
    
  • psfs public static final String

    public static final String
    
  • St

    String
    
  • thr

    throw new
    

results matching ""

    No results matching ""