Java tutorial
//package com.java2s; import java.util.Map; public class Main { public static <K> Map safeGetMap(Map<K, Object> map, K key) { if (map == null) { return null; } else { return map.containsKey(key) ? (Map) map.get(key) : null; } } }