LinkedHashMap with Looping
- 25th Sep 2018
- 0
- 14582
- how to loop elements in linkedhashmap in java Iterating LinkedHashMap using entryset with linkedhashmap in java
We can iterate Linkedhashmap using enhanced for loop with keyset() method or by using enhanced for loop with EntrySet() method or by using iterator Case 1 : Enhanced for loop with keyset() Example import java.util.*; public class LinkedHashMapEnhancedForLoopExample { public static void main(String args[]) { LinkedHashMap<Integer,String> lhm = new LinkedHashMap<>(); lhm.put(1, “One”); lhm.put(2, […]