Java Collection framework
Java Collection framework
1. Direct difference between Collection and Collections
Collection is an interface under the java. util package and a parent interface at the Collection framework level. List and set interfaces are commonly inherited. Allows you to insert, delete, and determine whether an element is a member or not, and traverse the element.
Collections is a tool class under the java. util package. It provides operations such as searching, sorting, replacing, and thread security in the collection.
Ii. list Interface
ArrayList: the underlying structure is array, fast query, slow insertion and deletion, and non-thread-safe. When the array exceeds the initial capacity, it will be resized by 50%.
Slow list: the underlying structure is linked list, slow query, fast insertion and deletion, and non-thread-safe.
Vector: the underlying structure is array, thread-safe, and is particularly slow in both insertion and query, extended by 100% of the array