`
gdwrx_winson
  • 浏览: 124959 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

Collections

    博客分类:
  • Java
阅读更多
Collections.unmodifiableSet() 二、 Collections的unmodifiableSet方法 Collections的unmodifiableXXX方法设定一个Collection或Map为只读,有四中类型,分别对应 Collection、List、Set、Map。他只有一个参数,一般的写法会是这样: Set set = new HashSet(); ..... set = Collections.unmodifiableSet(set); 此时如果你对容器实施写操作的话,会抛出UnsupportedOperationException。当然你可像 DisplaySetting一样,并不把容器本身的引用设为只读,而是提供给外部的接口的引用为只读。当然 可以自己提供一个私有的方法得到该引用,然后只允许自己对容器的内容修改。初看时感到很奇怪: private static final Set all = new HashSet(); public static final Set ALL = Collections.unmodifiableSet(all);
分享到:
评论

相关推荐

    commons-collections.jar

    commons-collections-20040616.jar, commons-collections-3.2-osgi.jar, commons-collections-3.2-sources.jar, commons-collections-3.2.1.jar, commons-collections-3.2.2-javadoc.jar, commons-collections-3.2.2...

    commons-collections-3.2.2-API文档-中文版.zip

    赠送jar包:commons-collections-3.2.2.jar; 赠送原API文档:commons-collections-3.2.2-javadoc.jar; 赠送源代码:commons-collections-3.2.2-sources.jar; 赠送Maven依赖信息文件:commons-collections-3.2.2....

    commons-collections4-4.4-API文档-中英对照版.zip

    赠送jar包:commons-collections4-4.4.jar; 赠送原API文档:commons-collections4-4.4-javadoc.jar; 赠送源代码:commons-collections4-4.4-sources.jar; 赠送Maven依赖信息文件:commons-collections4-4.4.pom;...

    commons-collections4-4.1-API文档-中文版.zip

    赠送jar包:commons-collections4-4.1.jar; 赠送原API文档:commons-collections4-4.1-javadoc.jar; 赠送源代码:commons-collections4-4.1-sources.jar; 赠送Maven依赖信息文件:commons-collections4-4.1.pom;...

    commons-collections4-4.4-API文档-中文版.zip

    赠送jar包:commons-collections4-4.4.jar; 赠送原API文档:commons-collections4-4.4-javadoc.jar; 赠送源代码:commons-collections4-4.4-sources.jar; 赠送Maven依赖信息文件:commons-collections4-4.4.pom;...

    collections-generic-4.01_and_looks-2.1.4

    该文件里包含两个.jar包: collections-generic-4.01.jar和looks-2.1.4.jar, 引入collections-generic-4.01.jar: 右击工程--》Build path ——》Add External JAR-->选中collections-generic-4.01.jar --》OK 在源...

    commons-collections-3.2.2-API文档-中英对照版.zip

    赠送jar包:commons-collections-3.2.2.jar; 赠送原API文档:commons-collections-3.2.2-javadoc.jar; 赠送源代码:commons-collections-3.2.2-sources.jar; 赠送Maven依赖信息文件:commons-collections-3.2.2....

    commons-collections-3.2.2.jar

    apache-common系列中的重要的成员:apache-common-collections。包中对Java中的集合类进行了一定的补充,定义了一些全新的集合,当然也是实现了Collection接口的,比如Bag,BidiMap。同时拥有新版本的原有集合,比如...

    commons-collections-3.2.1-API文档-中文版.zip

    赠送jar包:commons-collections-3.2.1.jar; 赠送原API文档:commons-collections-3.2.1-javadoc.jar; 赠送源代码:commons-collections-3.2.1-sources.jar; 包含翻译后的API文档:commons-collections-3.2.1-...

    commons-collections-3.2.1-API文档-中英对照版.zip

    赠送jar包:commons-collections-3.2.1.jar 赠送原API文档:commons-collections-3.2.1-javadoc.jar 赠送源代码:commons-collections-3.2.1-sources.jar 包含翻译后的API文档:commons-collections-3.2.1-...

    eclipse-collections-forkjoin-7.1.2-API文档-中文版.zip

    赠送jar包:eclipse-collections-forkjoin-7.1.2.jar; 赠送原API文档:eclipse-collections-forkjoin-7.1.2-javadoc.jar; 赠送源代码:eclipse-collections-forkjoin-7.1.2-sources.jar; 赠送Maven依赖信息文件:...

    commons-collections4-4.1-API文档-中英对照版.zip

    赠送jar包:commons-collections4-4.1.jar; 赠送原API文档:commons-collections4-4.1-javadoc.jar; 赠送源代码:commons-collections4-4.1-sources.jar; 赠送Maven依赖信息文件:commons-collections4-4.1.pom;...

    eclipse-collections-7.1.2-API文档-中文版.zip

    赠送jar包:eclipse-collections-7.1.2.jar; 赠送原API文档:eclipse-collections-7.1.2-javadoc.jar; 赠送源代码:eclipse-collections-7.1.2-sources.jar; 赠送Maven依赖信息文件:eclipse-collections-7.1.2....

    commons-collections4-4.2-bin

    commons-collections4-4.2-bin commons下的collections包

    commons-collections4-4.1

    commons-collections4-4.1,用来修复java反序列漏洞,重命名后替换之前Middleware\modules下的的3.2.0版

    commons-collections-3.2.1-bin

    commons-collections-3.2.1-bin

    commons-collections4-4.2资源包

    Apache Commons Collections 4.2、可重用的java工具包。

    commons-collections4-4.1.jar

    java读取excel2007解决org.apache.commons.collections找不到的问题。

Global site tag (gtag.js) - Google Analytics