Java Design Pattern
Introduction to Java 10
Introduction to Java 11
Introduction to Java 12

JAVA LinkedHashMap Interface

  • • A LinkedHashMap contains values based on the key. It implements the Map interface and extends HashMap class.
  • • It contains only unique elements.
  • • It contains only unique elements.
  • • Insertion order is preserved.
LinkedHashMapDemo.java
import java.util.*;
class LinkedHashMapDemo
{
public static void main(String[] args)
{
LinkedHashMap<Integer, String> hm=new

LinkedHashMap<Integer,String>();
hm.put(100,"Tapuuu");
hm.put(101,"Silan");

hm.put(102,"Akshay");

for(Map.Entry m:hm.entrySet())
{
System.out.println(m.getKey()+" "+m.getValue());
}
}
}

Output

100 Tapuuu
101 Silan
102 Akshay

About the Author



Silan Software is one of the India's leading provider of offline & online training for Java, Python, AI (Machine Learning, Deep Learning), Data Science, Software Development & many more emerging Technologies.


We provide Academic Training || Industrial Training || Corporate Training || Internship || Java || Python || AI using Python || Data Science etc






 PreviousNext