A .Arrays categories:
conventional method (the array into a set):
public static List asList (A T ...) is equivalent to public static List asList (T [] a).
Note: List object is obtained by a method Arrays.asList length is fixed and can not increase nor decrease.
the ArrayList asList method returns the object, but not java.util.ArrayList Arrays internal class object class.
two categories .Collections
Collections class: encapsulates Set, List, Map . the method of operating a tool of
acquiring objects empty set (no element of the set, note collection is not null):
Commonly used collections:
HashSet / ArrayList / HashMap is thread safe, unsafe in a multithreaded environment
have acquired a set of thread-safe method in the Collections class:
List List = Collections.synchronizedList (new new ArrayList ());
when the iterations do have to use the synchronized.
the synchronized (List) {
the TODO
}
Set set = Collections.synchronizedSet(new HashSet());
Map map = Collections.synchronizedMap(new HashMap());
三.
四.