import java.util.LinkedHashMap;
import java.util.Map;
public class AddDemo {
public static void main(String[] args) {
//creating LinkedHashMap
LinkedHashMap<Integer, String> lhm = new LinkedHashMap<>();
//adding element to our LinkedHashMap
lhm.put(21, "Amit");
lhm.put(5, "Rahul");
lhm.put(13, "Veeru");
lhm.put(34, "Subhash");
lhm.put(19, "Saahil");
//printing values using for each loop
//insertion order is maintained in LinkedHashMap
for (Map.Entry m : lhm.entrySet()) {
System.out.println(
"key = " + m.getKey() + "," + "Value = " + m.getValue()
);
}
}
}