[Java] How to use LinkedHashMap class

Programming study diary

December 31, 2020 A brief summary of how to use the LinkedHashMap class.

What is 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.

How to use

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)

References

Sample usage of Java Linked HashMap Active engineers explain how to use Java's LinkedHashMap class [for beginners] Class LinkedHashMap <K, V>

Recommended Posts

[Java] How to use LinkedHashMap class
How to use java class
How to use class methods [Java]
[Java] How to use Math class
[Java] How to use the File class
[Java] How to use the HashMap class
[Processing × Java] How to use the class
How to use Java Scanner class (Note)
[Java] How to use the Calendar class
[Java] How to use Map
[Java] How to use Map
How to use java Optional
[Java] How to use Optional ②
[Java] How to use removeAll ()
[Java] How to use string.format
How to use Java Map
How to use Java variables
[Java] How to use Optional ①
[Java] How to use Calendar class and Date class
[Java] How to use compareTo method of Date class
How to use Java HttpClient (Get)
How to disassemble Java class files
How to use Java HttpClient (Post)
[Java] How to use join method
How to use the wrapper class
[Processing × Java] How to use variables
How to decompile java class files
[JavaFX] [Java8] How to use GridPane
[Java] How to use List [ArrayList]
How to use classes in Java?
[Processing × Java] How to use arrays
How to use Java lambda expressions
How to use Java enum type
Multilingual Locale in Java How to use Locale
[Java] How to use the hasNext function
How to use submit method (Java Silver)
[Easy-to-understand explanation! ] How to use Java instance
Studying how to use the constructor (java)
[Processing × Java] How to use the loop
How to use Java classes, definitions, import
[Easy-to-understand explanation! ] How to use Java polymorphism
[Java] [Maven3] Summary of how to use Maven3
[Processing × Java] How to use the function
[Easy-to-understand explanation! ] How to use ArrayList [Java]
[Java] Learn how to use Optional correctly
[Easy-to-understand explanation! ] How to use Java overload
try-catch-finally exception handling How to use java
[Easy-to-understand explanation! ] How to use Java encapsulation
How to use Map
How to use rbenv
How to use letter_opener_web
How to use with_option
How to use fields_for
How to use map
How to use collection_select
How to use Twitter4J
How to use active_hash! !!
How to use MapStruct
How to use hidden_field_tag
How to use TreeSet
[How to use label]