Map |
1, key-value pairs of objects, a mapping can not include duplicate keys; 2, some mapping implementation can ensure the order , such as TreeMap class; 3, other mappings can not guarantee the order, such as HashMap class; 4, KeySet () extract key sequence; 5. All keys in the map generate a set, not duplicates ; 6. Values () extracts the value sequence; 7, all values in the map generate a collection; |
List |
1, can randomly access The elements contained, the elements are ordered ; 2, can be in any position to add, delete elements; 3, no matter how many times, the element position is unchanged ; 4, allow repeating elements; 5, using Iterator to realize unidirectional traversal; 6, using listiterator to realize bidirectional traversal; |
Queue |
1, first-out; 2, with offer () to add elements; 3, using poll () to obtain the removal of elements; 4, using Element () or peek () to obtain the front-end elements; |
Stack |
1, last in first out ; 2, inheriting vectors, thread synchronization , that is, thread-safe; 3, using push, pop, peek, empty, search and other methods; |
Set |
1. Collection containing non-repeating elements ; 2, set does not contain o1.equals (O2) elements; 3, the O1 and O2 contain a maximum of a null element; 4, can not randomly access the elements contained; 5, can only use iterator to achieve one-way traversal; 6, Set no synchronization method; |
Features and usage of MAP, Set, List, Queue, stack