为啥突然分享下这个,也是从mybatis源码看到了,所以想分享下:
org.apache.ibatis.plugin.InterceptorChain
使用 Collections.unmodifiableList();
示例:
public static void main(String[] args) {
List<String> canNotEditList = getCanNotEditList();
canNotEditList.add("收藏");
System.out.println(canNotEditList.toString());
}
private static List<String> getCanNotEditList() {
List<String> canNotEditList = new ArrayList<>();
canNotEditList.add("请");
canNotEditList.add("点");
canNotEditList.add("赞");
return Collections.unmodifiableList(canNotEditList);
}
运行效果:
不给动。