以下实例演示了如何使用 Collection 类的 Collections.unmodifiableList() 方法来设置集合为只读:
Main.java 文件
以上代码运行输出结果为:
集合现在是只读