Java Program to Print LinkedHashMap Values Last Updated : 23 Jul, 2025 Comments Improve Suggest changes Like Article Like Report LinkedHashMap is a predefined class in Java that is similar to HashMap, contains key and its respective value unlike HashMap, In LinkedHashMap insertion order is preserved. We need to print the value of the hash map which is linked with its key. We have to iterate through each Key present in our LinkedHashMap and print its respective value by using a for loop. Example: Input: Key- 2 : Value-5 Key- 4 : Value-3 Key- 1 : Value-10 Key- 3 : Value-12 Key- 5 : Value-6 Output: 5, 3, 10, 12, 6 Algorithm: Use For-each loop to iterate through LinkedHashMap.Using entrySet() method which gives the set structure of all the mappings of the map for iterating through the whole map. For each iteration print its respective value Example: Java // Java program to print all the values // of the LinkedHashMap import java.util.*; import java.io.*; class GFG { public static void main (String[] args) { LinkedHashMap<Integer,Integer> LHM = new LinkedHashMap<>(); LHM.put(2,5); LHM.put(4,3); LHM.put(1,10); LHM.put(3,12); LHM.put(5,6); // using .entrySet() which gives us the // list of mappings of the Map for(Map.Entry<Integer,Integer>it:LHM.entrySet()) System.out.print(it.getValue()+", "); } } Output5, 3, 10, 12, 6, Time complexity: O(n). Comment More info K kushwahp1234 Follow Improve Article Tags : Java Technical Scripter Java Programs Technical Scripter 2020 Java-Collections Java-LinkedHashMap +2 More Explore Java BasicsIntroduction to Java4 min readJava Programming Basics9 min readJava Methods7 min readAccess Modifiers in Java6 min readArrays in Java9 min readJava Strings8 min readRegular Expressions in Java7 min readOOP & InterfacesClasses and Objects in Java10 min readAccess Modifiers in Java6 min readJava Constructors10 min readJava OOP(Object Oriented Programming) Concepts10 min readJava Packages7 min readJava Interface11 min readCollectionsCollections in Java12 min readCollections Class in Java13 min readCollection Interface in Java6 min readIterator in Java5 min readJava Comparator Interface6 min readException HandlingJava Exception Handling8 min readJava Try Catch Block4 min readJava final, finally and finalize4 min readChained Exceptions in Java3 min readNull Pointer Exception in Java5 min readException Handling with Method Overriding in Java4 min readJava AdvancedJava Multithreading Tutorial3 min readSynchronization in Java10 min readFile Handling in Java4 min readJava Method References9 min readJava 8 Stream Tutorial7 min readJava Networking15+ min readJDBC Tutorial5 min readJava Memory Management4 min readGarbage Collection in Java6 min readMemory Leaks in Java3 min readPractice JavaJava Interview Questions and Answers15+ min readJava Programs - Java Programming Examples8 min readJava Exercises - Basic to Advanced Java Practice Programs with Solutions5 min readJava Quiz | Level Up Your Java Skills1 min readTop 50 Java Project Ideas For Beginners and Advanced [Update 2025]15+ min read Like