Java tutorial
//package com.java2s; //License from project: Apache License import java.util.Map; public class Main { public static <K, V> V getIfNotNull(final Map<? super K, ? extends V> map, final K key) { return (map != null) && (key != null) ? map.get(key) : null; } }