December 31, 2020 A brief summary of how to use the LinkedHashMap class.
Information is stored and used as a key / value pair in the same way as the HashMap class. Since the LinkedHashMap class inherits from the HashMap class, it has the functions of the HashMap class. The HashMap class does not guarantee the order of the elements, but the LinkedHashMap class retains the stored order.
As a feature, it holds elements in key / value pairs and does not allow duplicate keys. Null can be a key or value. Keeps the order in which the elements are stored.
The method for adding elements is a method implemented in java.util.HashMap class, and the subclass LinkedHashMap class also adds elements with the same method. The element acquisition method returns the value that has the object specified by the argument as the key. Returns null if the key is not in the LinkedHashMap.
Basic writing
//Add element
public V put(K key, V value)
//Get element
public V get(object key)
Sample usage of Java Linked HashMap Active engineers explain how to use Java's LinkedHashMap class [for beginners] Class LinkedHashMap <K, V>
Recommended Posts