collection与collections
Collection is a collection of interfaces, which method provides a common interface to perform basic operations collection object, the set of all its subclasses are like List, Set the like.
Collections is a wrapper class contains many static methods, can not be instantiated as a tool category, such as sorting method provides:. Collections sort (list).
java inside container divided into two classes, the Map Collection and
queue detailed analysis:
The nature of PriorityQueue
PriorityQueue essence, is a dynamic array, in this regard is consistent with the ArrayList.
When PriorityQueue call the default constructor, the default initial capacity ( DEFAULT_INITIAL_CAPACITY=11
) to create a PriorityQueue, and orders its elements according to their natural order (wherein the collection element is added using the implemented Comparable).
https://www.cnblogs.com/lemon-flm/p/7877898.html
ArrayList, Vector, LinkedList compare
(1) If you need to traverse the collection, ArrayList and the Vector by way of random access is better, LinkedList way through the iterator is better;
(2) require frequent insert, delete operation when using LinkedList is better, because he used the list to achieve, ArrayList Vector and internal expansion will be dynamically allocated size, time-consuming;
(3) requires thread safety, consider using Vector.