[Reprint] Detailed explanation of the relationship between ArrayList
[Reprint] Detailed explanation of the relationship between ArrayList, List, LinkedList, and Collection in java
Reprint link: http://www.cnblogs.com/liqiu/p/3302607.html Detailed explanation of the relationship between ArrayList, List, LinkedList, and Collection in java 1. Basic introduction (Set, List, Map) Set (set): The elements in the set are not ordered in a particular way, and there are no duplicate objects. Some of its implementation classes can sort objects in a collection in a specific way. List (list): The elements in the collection are sorted by index position. There can be duplicate objects, allowing objects to be retrieved according to their index position in the collection. Map (mapping): Each element in the collection contains a pair of key objects and value objects. There are no duplicate key objects in the collection, and the value objects can be repeated. Some of its implementation classes can sort key objects in a collection. 2. Basic interfaces and types 1. Iterator interface This interface allows traversing all elements in the collection. There are three methods: public boolean hasNext(): Determine whether there is a next element. public Object next(): Get the next element. Note that the return value is Object and may require type conversion. If there are no more elements available, a NoSuchElementException is thrown. Before using this method, you must first use…
[Reprint] Detailed explanation of the relationship between ArrayList, List, LinkedList, and Collection in java
Reprint link: http://www.cnblogs.com/liqiu/p/3302607.html Detailed explanation of the relationship between ArrayList, List, LinkedList, and Collection in java 1. Basic introduction (Set, List, Map) Set (set): The elements in the set are not ordered in a particular way, and there are no duplicate objects. Some of its implementation classes can sort objects in a collection in a specific way. List (list): The elements in the collection are sorted by index position. There can be duplicate objects, allowing objects to be retrieved according to their index position in the collection. Map (mapping): Each element in the collection contains a pair of key objects and value objects. There are no duplicate key objects in the collection, and the value objects can be repeated. Some of its implementation classes can sort key objects in a collection. 2. Basic interfaces and types 1. Iterator interface This interface allows traversing all elements in the collection. There are three methods: public boolean hasNext(): Determine whether there is a next element. public Object next(): Get the next element. Note that the return value is Object and may require type conversion. If there are no more elements available, a NoSuchElementException is thrown. Before using this method, you must first use…
[Reprint] Detailed explanation of the relationship between ArrayList, List, LinkedList, and Collection in java
Reprint link: http://www.cnblogs.com/liqiu/p/3302607.html Detailed explanation of the relationship between ArrayList, List, LinkedList, and Collection in java 1. Basic introduction (Set, List, Map) Set (set): The elements in the set are not ordered in a particular way, and there are no duplicate objects. Some of its implementation classes can sort objects in a collection in a specific way. List (list): The elements in the collection are sorted by index position. There can be duplicate objects, allowing the object to be retrieved according to the index position of the object in the collection. Map: Each element in the collection contains a pair of key objects and value objects. There are no duplicate key objects in the collection, and the value objects can be repeated. Some of its implementation classes can sort key objects in a collection. 2. Basic interfaces and types 1. Iterator interface This interface allows traversing all elements in the collection. There are three methods: public boolean hasNext(): Determine whether there is a next element. public Object next(): Get the next element. Note that the return value is Object and may require type conversion. If there are no more elements available, a NoSuchElementException is thrown. Before using this method, you…
[Reprint] Detailed explanation of the relationship between ArrayList, List, LinkedList, and Collection in java
Reprint link: http://www.cnblogs.com/liqiu/p/3302607.html Detailed explanation of the relationship between ArrayList, List, LinkedList, and Collection in java 1. Basic introduction (Set, List, Map) Set (set): The elements in the set are not ordered in a particular way, and there are no duplicate objects. Some of its implementation classes can sort objects in a collection in a specific way. List (list): The elements in the collection are sorted by index position. There can be duplicate objects, allowing the object to be retrieved according to the index position of the object in the collection. Map: Each element in the collection contains a pair of key objects and value objects. There are no duplicate key objects in the collection, and the value objects can be repeated. Some of its implementation classes can sort key objects in a collection. 2. Basic interfaces and types 1. Iterator interface This interface allows traversing all elements in the collection. There are three methods: public boolean hasNext(): Determine whether there is a next element. public Object next(): Get the next element. Note that the return value is Object and may require type conversion. If there are no more elements available, a NoSuchElementException is thrown. Before using this method, you…