public interface Collection<E> extends Iterable<E>
Collection继承了Iterable接口,即继承了Iterable接口中的方法:
Iterator<T> iterator();
default void forEach(Consumer<? super T> action);
接下来看Collection接口定义的方法:
int size();
boolean isEmpty();
boolean contains(Object o);
Iterator<E> iterator();
Object[] toArray();
<T> T[] toArray(T[] a);
boolean add(E e);
boolean remove(Object o);
boolean containsAll(Collection<?> c);
boolean addAll(Collection<? extends E> c);
boolean removeAll(Collection<?> c);
default boolean removeIf(Predicate<? super E> filter);
boolean retainAll(Collection<?> c);
void clear();
boolean equals(Object o);
int hashCode();
继承了Collection接口的有List、Set、Queue三大接口,接下来会一一分析