Java record-72-Vector, HashTable and Properties

Source: Internet
Author: User

Java record-72-Vector, HashTable and Properties
Legacy collection classes: VectorVector implements dynamic arrays. This is similar to ArrayList, but the two are different: Vector is synchronized, and it contains many methods left over from previous versions that do not belong to the class set framework. With the release of Java2, Vector has been redesigned to expand AbstractList and implement the List interface. Therefore, it is fully compatible with the class set. The bottom layer of Vector also maintains an array. HashTable is a part of the original java. util and a specific implementation of Dictionary. However, Java 2 re-designs the HashTable interface so that it can also implement the Map interface. Therefore, HashTable is also integrated into the class set framework. It is similar to HashMap, but it is synchronous. Like HashMap, HashTable stores key/value pairs in the hash table. When HashTable is used, an object is specified as a keyword, and the value associated with this keyword is also specified. This keyword is then hashed, and the obtained hash value is used as the subscript of the value stored in the table. Properties is a subclass of HashTable. The Properties class represents a persistent property set. Properties can be saved to or loaded from a stream. In the attribute list, each key and its corresponding value are a string. The Properties class is used by many other Java classes. For example, when the System environment value is obtained, System. getProperties () returns the object type. An attribute list can contain another attribute list as its "Default Value". If the attribute key cannot be found in the original attribute list, the second attribute list is searched. One of the most useful aspects of Properties is that the store () and load () methods can be used to conveniently store information contained in the Properties object or load information from the disk. At any time, a Properties object can be written to a stream or read from it. This makes the attribute list easy to implement a simple database.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.