initialize a static map/hashmap in java

https:/‮/‬www.lautturi.com
initialize a static map/hashmap in java
/**
 * @author lautturi.com
 * Java example: initialize a static map/hashmap in java
 */

import java.util.*;
import java.util.Map.Entry;

public class Lautturi {
	private static final Map<Integer, String> map = Map.of(
		5, "Apple", 
		7, "Banana", 
		12, "Cherry", 
		33, "Orange"
	);

	public static void main(String[] args) {

		Set<Integer> key = map.keySet();

		for (Integer keys : key) {
			System.out.println(keys + " : " + map.get(keys));
		}

	}
}

output:

33 : Orange
12 : Cherry
5 : Apple
7 : Banana
Created Time:2017-09-08 14:53:16  Author:lautturi