Collection:
ArrayList:
1: The underlying implementation is an array, the default length is 10.
2:add (), determines whether the array is out of bounds, is the array expansion of twice times the original.
3:remove (), copy array, size-1, frees up empty space.
HashSet:
The underlying implementation is a HASHMAP, the value exists on the key of the map, value is stored in an object, that is, the underlying HASHMAP value is the same.
HashSet are unordered and do not allow repetition.
MAP:
HASHMAP:
Initial capacity value: 10, Load factor 0.75f.
When put (), the first object is initialized with a capacity of 12.
The underlying is a entry array, which, according to the hash value, determines the position of the entry array where the object Val objects exist.
Note that when traversing a map with iterator, the Remove () method cannot be called during traversal, otherwise an error will be made.
Java.util.ConcurrentModificationException
At Java.util.hashmap$hashiterator.nextentry (hashmap.java:922)
At Java.util.hashmap$entryiterator.next (hashmap.java:962)
At Java.util.hashmap$entryiterator.next (hashmap.java:960)
Reason:
When the HashMap iterator is obtained, Expectedmodcount = Modcount;modcount is put in the constructor: (Record map Add, delete, modcount+1)
In the iterative process how to call the Remove () or add () method, Modcont+1, in Iterator.next () will be to compare expectedmodcount and Modcont is equal, unequal, error.
Source:
Introduction to the basic implementation of Java common set framework and the attention point