1. Four sets of Hashtable, Hashmap, Treemap, and LinkedHashmap store and manipulate data in key-value pairs.

(1) Hashtable is a Hashtable implementation provided by the Java class library. It supports synchronization. It does not support NULL keys and null values. (2) HashMap is a more widely used hash table implementation that does not support synchronization and supports NULL keys and NULL values. (3) Both are based on the zipper method, are hash table.

(1) A Hashmap does a quick lookup of its contents using Hashcode, and all elements in a Treemap maintain some fixed order. (2) HashMap is not thread-safe; TreeMap is not thread-safe. (3) HashMap is implemented based on hash table. The key classes required to be added using HashMap explicitly define hashCode() and equals()[you can override hashCode() and equals()]. (4) TreeMap, realized based on red-black tree, is always in a balanced state. (5) HashMap is used to insert, delete, and locate elements in a Map; Treemap is suitable for traversing keys in natural or custom order.

4.LinkedHashMap is a subclass of HashMap. If you want the output order to be the same as the input order, you can use LinkedHashMap.