Collection方法 -API-Iterable (迭代器)
boolean add(E e) ->向集合中添加元素
boolean addAll(Collection<? extends E> c) ->两个集合合并
void clear() ->清空
boolean contains(Object o) ->是否包含xx
boolean containsAll(Collection<?> c) ->是否包含另一个集合所有元素
boolean equals(Object o) ->元素是否相等
int hashCode()
boolean isEmpty() ->是否包含元素
boolean remove(Object o) ->移除指定元素
boolean removeAll(Collection<?> c) ->移除给定集合中包含的全部元素
boolean retainAll(Collection<?> c) ->是否包含指定集合的全部元素
int size() ->元素个数
Object[] toArray() ->Object[] arr=c.toArray();->集合转换为数组(Object类型)
T[] toArray(T[] a) ->String []strarr=c.toArray(new String[0]);->转换为具体类型的数组
Iterator iterator()
<泛型>:编译语法
动态把类型作为参数
规范程序员
不规定类型,为Object类型;传什么类型就是什么类型