目录
场景
空指针、数组越界、条件处理
demo
package com.nio4444.demo;
import com.google.common.base.Preconditions;
public class PreconditionsDemo {
public static void main(String[] args) {
String result = null ;
// Preconditions.checkNotNull(result,"result 不能为空") ;
String [] arr = new String[]{};
// Preconditions.checkElementIndex(3,arr.length,"数组索引越界");
Preconditions.checkState(1>2,"条件不满足");
}
}