- public class Jihe {
- /**
- * @param args
- */
- public static void main(String[] args) {
- /**
- * 集合框架
- * 集合的由来:
- * 对象用于封装特有的数据,对象过多就需要存储,如果对象的个数不确定。就使用集合框架进行存储。
- *
- * 集合的特点:
- * 1,用于存储对象的容器;
- * 2,集合的长度是可变的;
- * 3,集合中不能存储基本数据类型(这是和数组的区别);
- *
- * 集合容器因为内部的数据结构不同,有多种具体容器。
- * 框架的顶层元素是Collection接口
- */
- /**
- * Collection接口的常用方法。
- *
- * 1,添加的方法:
- * boolean add(Object obj);//添加一个对象
- * boolean addAll(Collection coll);//将指定的collection中的所有的元素都添加到collection中。
- *
- * 2,删除的方法:
- * boolean remove(Object obj);//从collection中移除指定的单个实例(if存在这个实例)
- * boolean removeAll(collection coll);//移除从collection中那些也包含在指定的collection中的所有元素。
- *
- * 3,判断的方法:
- * boolean contains(Object obj)//判断在该collection中是否存在该对象。
- * boolean containsAll(collection coll);//判断次collection中是否包含指定的collection的所有元素。
- *
- * 4,获取的方法:
- * int size();//返回该集合的元素的个数。
- * Interator interator();//迭代该集合。
- *
- *
- */
- }
- }
常用对象API(集合框架--概述,体系和共性功能)
最新推荐文章于 2021-12-19 10:14:16 发布