Java analysis (2): Collection and Collectes difference

xiaoxiao2021-03-06  71

The difference between Collection and Collectes.

Collections is a class under java.util that contains a variety of static methods related to the collection.

Collection is an interface under java.util, which is a parent interface of a variety of collections.

List, SET, MAP inherits from the Collection interface? List, SET is MAP is not

ARRAYLIST and VECTOR differences.

I. Synchronization: Vector is a thread safe, that is to say is synchronized, and ArrayList is unsafe, not synchronized. Data growth: When you need to grow, Vector default growth to the original one, and arraylist It is half of the original

Differences between HashMap and HashTable

I. Historical reasons: HashTable is an implementation of the MAP interface introduced by the Java 1.2 based on the old Dictionary class.

II. Synchronization: Hashtable is a thread safe, that is, HashMap is unsafe, not synchronous

Three. Values: Only HashMap allows you to take null values ​​as a key or value of a table

转载请注明原文地址:https://www.9cbs.com/read-89040.html

New Post(0)