ArrayList(JDK1.9)

First, the ArrayList concept.

   1. Data structure. It is an array, an array that can grow dynamically.

 

  2. Inheritance implementation diagram. Inherit abstract List, implement List, random method, clone, serialization.

  3、

 

Second, the inner class.

final class ArrayListSpliterator implements Spliterator<E>
private class Itr implements Iterator<E>
private class ListItr extends Itr implements ListIterator<E>
private static class SubList<E> extends AbstractList<E> implements RandomAccess

Three, member variables.

 

   1. Array elementData. is the most important member. Store real data.

   2. Size.

   3. The default capacity of the array is DEFAULT_CAPACITY.

 

   4. The maximum capacity of the array is MAX_ARRAY_SIZE.

   5. Empty array EMPTY_ELEMENTDATA. Returned when the user-specified capacity is 0.

 

   6. An empty array with default capacity DEFAULTCAPACITY_EMPTY_ELEMENTDATA.

 

   7. Serial number.

 

   3、

   3、

4. Membership method.

  1. Construction method 1. Specifies the array size. Check the validity of the capacity parameter. Determine the array size.

  2. Construction method 2. Do not specify capacity. is an empty array.

  3. Construction method 3. Initialize with a collection.

 

 

  4、

  3、

  4、

  3、

  4、

  3、

  4、

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324652959&siteId=291194637