Collection>
boolean contains(Object o):return true only if has (o==null ? e==null :o.equals(e))
boolean removeAll(Collection<?> c); remove elements in c
boolean retainAll(Collection<?> c); remove elements not in c
Queue VS List VS Set
List>
ListIterator<E> listIterator();| Iterator<E> iterator();
next() & previous()|only has next()
add() & remove()|only has remove()
* you can not use list.add() during both two iteration, otherwise,ConcurrentModificationException
RandomAccess>
Marker interface used by List implementations to indicate that they support fast (generally constant time) random access. e.g.
for (int i=0, n=list.size(); i < n; i++)
list.get(i);
runs faster than this loop:
for (Iterator i=list.iterator(); i.hasNext(); )
i.next();
HashMap, HashSet, HashTable>
HashMap(int initialCapacity, float loadFactor) resize()
HashSet(int initialCapacity, float loadFactor) {map = new HashMap<E,Object>(initialCapacity, loadFactor);}
Hashtable(int initialCapacity, float loadFactor) extends Dictionary<K,V> ; synchronized ; rehash();
hash = hash(key.hashCode());
*TreeMap Red-black mechanics