Java tutorial
//package com.java2s; //it under the terms of the GNU Affero General Public License as published by import java.util.Collection; import java.util.Collections; import java.util.Map; public class Main { /** * @param mp * @return the values of mp or an empty set, if <code>mp == null</code>. * @postcondition result != null */ public static <K, V> Collection<V> valuesOrEmptySet(Map<K, V> mp) { final Collection<V> result = (mp == null) ? Collections.<V>emptySet() : mp.values(); assert result != null; return result; } }