Java iterate through a hashmap

‮h‬ttps://www.lautturi.com
Java iterate through a hashmap
/**
 * @author lautturi.com
 * Java example: 
 */

import java.util.*;

public class Lautturi {
    
	public static void main(String[] args) {
		HashMap<String, Integer> map = new HashMap<>();

		map.put("Apple", 21);
		map.put("Banana", 12);
		map.put("Cherry", 15);
		map.put("Orange", 35);	

        for (Map.Entry<String, Integer> entry : map.entrySet()) {
        	System.out.println(entry.getKey() + " = " + entry.getValue());
        }
		
	}
}

output:

Apple = 21
Cherry = 15
Orange = 35
Banana = 12
Created Time:2017-09-08 14:30:23  Author:lautturi