public interface Collection<E> extends Iterable<E>{
int
size();
boolean
boolean contains(Object
o);
Iterator<E>
iterator();
Object[]
toArray();
数组的类型是object类型(注意类型转换),不支持泛型
<T> T[]
toArray(T[]
a);
如果参数的数据类型和集合中元素的数据类型不同,编译器会报出异常
boolean add(E
e);
如果集合中不允许添加相同的元素,则返回false。
boolean remove(Object
o);
null值,则删除集合中值为null的元素
boolean
containsAll(Collection<?>
c);
boolean
addAll(Collection<? extends E>
c);
将参数对象集合的全部元素添加到调用addAll方法的集合中
boolean
removeAll(Collection<?>
c);
boolean
retainAll(Collection<?>
c);
void
clear();
boolean equals(Object
o);
int
hashCode();
}