Java容器
来源:互联网 发布:优化xp电脑批处理工具 编辑:程序博客网 时间:2024/06/01 09:33
1. 填充容器
Collection Framework中有2个工具类,分别是Collections和Arrays类,这2个类有很多静态方法,可以完成集合的操作。
Collections 类:
static <T> List<T> nCopies(int n, T o):
Returns an immutable list consisting of n copies of the specified object
static <T> void fill(List<? super T> list, T obj)
Replaces all of the elements of the specified list with the specified element.
ArrayList<Airtest> list = new ArrayList(Collections.nCopies(4, new Airtest("airtest")));System.out.println(list);Collections.fill(list, new Airtest("testair"));System.out.println(list);
1. Map:
标准java类库中包含Map的几种基本实现,包括:HashMap,TreeMap,LinkedHashMap,WeakHashMap,ConcurrentHashMap,IdentityHashMap。
HashMap使用散列码来进行搜索。散列码是相对唯一的、用以代表对象的int值,通过将该对象的某些信息进行转换而生成。hashCode()是根类Object中的方法,所有java对象都可以产生散列码。
0 0
- Java容器:容器一览
- Java容器
- Java容器
- java容器
- java容器
- Java容器
- java容器
- JAVA容器
- JAVA 容器
- java 容器
- java容器
- java容器
- java容器
- JAVA容器
- java容器
- java 容器
- java容器
- JAVA 容器
- Cocoapods安装及其使用详解
- 初学Linux(3)
- Web开发(jsp+javaBean+servlet )之文件上传
- Android属性(property)机制
- mysql linux 下面安装
- Java容器
- 在AS中logcat的设置过滤信息图文教程
- 分布式日志收集之Logstash 笔记(一)
- mysql REPLACE 语句的使用
- 调试
- MP4文件格式详解——结构概述 (转)
- Codeforces Round #329 (Div. 2)A. 2Char(暴力枚举)
- ios开发常用RGB色值
- Eclipse SVN的使用