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)
{
LinkedHashMaphm=newLinkedHashMap();
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

Our Services:

Java Training | Python Training | Machine Learning with Python Training | Deep Learning with Python Training | Projects

SILAN Technology
Call to: 9439202111  |  9658317757  |  0674-2361252

Comment