所谓 collections framework 就是 java.util, java.util.concurrent 里面的一堆容器类。
------------------------
java.util.Collection, 除了 Map 外,所有其他容器的基类。所有容器接口可分为四类:
== Adding Elements ==
boolean add(E e);
boolean addAll(Collection<? extrends E> c);
== Removing Elements ==
boolean remove(Object o);
void clear(); // remove all elements
boolean removeAll(Collection<?> c); // remove the elements in c
boolean retainAll(Collection<?> c); // remove the elements *not* in c
== Querying the Contents of a Collection ==
boolean contains(Object o); // true if o is present
boolean containsAll(Collection<?> c); // true if all elements of c are in the collection
boolean isEmpty();
int size();
== Making a Collection's Contents Available for Further Processing ==
Iterator<E> iterator();
Object[] toArray(); // copy contents to an Object[]
<T> T[] toArray(T[] t); // copy contents to a T[] (for any T), 这个是个奇怪的接口
评论