P513 枚举类与注解-集合框架与项目的对比及概述
package com.collection;
public class CollectionTest {
/**
* 一、集合框架概述
* 1. 集合和数组的概念
* 2. 数组存储数据的特点
* 3. 数组存储数据的缺点
*/
}
P514 枚举类与注解-集合框架涉及到的API
/**
* 二、集合框架
* 1. Collection(list[ArrayList,LinkedList,Vector]--动态数组, set[HashSet,LinkedHashSet,TreeSet]--)
* 2. Map[HashMap,LinkedHashMap,TreeMap,HashTable,Properties]
* /
P515 枚举类与注解-Collection接口中的常用方法1
package com.collection;
import org.junit.Test;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
public class CollectionTest {
/**
* 一、集合框架概述
* 1. 集合和数组的概念
* 2. 数组存储数据的特点
* 3. 数组存储数据的缺点
* 二、集合框架
* 1. Collection(list[ArrayList,LinkedList,Vector]--动态数组, set[HashSet,LinkedHashSet,TreeSet]--)
* 2. Map[HashMap,LinkedHashMap,TreeMap,HashTable,Properties]
* 三、Collection接口API
*/
@Test
public void test1(){
Collection coll = new ArrayList();
// add
coll.add("AA");
coll.add("BB");
coll.add(123); //自动装箱
coll.add(new Date());
//size 获取添加元素的个数
System.out.println(coll.size());
//addAll
Collection coll1 = new ArrayList();
coll1.add(456);
coll.addAll(coll1);
System.out.println(coll);
//clear
coll.clear();
//isEmpty
System.out.println(coll.isEmpty());
}
}
P516 集合-每日一考
1.什么是枚举类?枚举类的对象声明的修饰符都有哪些?
2.什么是元注解?说说Retention和Target元注解的作用
3.说说你理解的集合框架有哪些接口,存储数据的特点是什么
4.比较throw和throws的异同