当一个方法中,有一个参数为List时,一定要注意,如果此时List为空时,不可直接add元素,否则会报错(UnsupportedOperationException),因为emptyList不允许add元素,一定要判空之后再操作
if(CollectionUtils.isEmpty(opRecordsList)){
opRecordsList= Lists.newArrayList();
}
当一个方法中,有一个参数为List时,一定要注意,如果此时List为空时,不可直接add元素,否则会报错(UnsupportedOperationException),因为emptyList不允许add元素,一定要判空之后再操作
if(CollectionUtils.isEmpty(opRecordsList)){
opRecordsList= Lists.newArrayList();
}