Java tutorial
//package com.java2s; import java.util.HashMap; import java.util.Map; public class Main { public static final String DEFAULT_PROP_KEY = "prop"; public static Map<String, Object> getProps(Map<String, Object> map) { @SuppressWarnings("unchecked") Map<String, Object> props = (Map<String, Object>) map.get(DEFAULT_PROP_KEY); if (null == props) { props = getHashMap(); map.put(DEFAULT_PROP_KEY, props); } return props; } public static Map<String, Object> getHashMap() { return new HashMap<String, Object>(); } }