Home
Cloud
Big Data
CI
Install
Samples
Java
Ubuntu
Maven
Archive
Java
|
LinkedHashMap
Notes
Example
Notes
Ordered entries
Duplicates elements not allowed
Example
LinkedHashMap<Integer, String> lhm = new LinkedHashMap<>(); lhm.clear(); // lhm.put(null, "a"); // OK // lhm.put(0, null); // OK lhm.put(0, "a"); lhm.put(44444, "c"); lhm.put(555555, "b"); lhm.put(3333, "d"); lhm.put(11, "f"); lhm.put(222, "e"); lhm.put(6666666, "g"); for (Map.Entry<Integer, String> entry : lhm.entrySet()) { System.out.println(entry.getKey() + " = " + entry.getValue()); }
Output:
0 = a 44444 = c 555555 = b 3333 = d 11 = f 222 = e 6666666 = g
© 2010-2022
mti
tek