public static <M extends Map<K, V>, K, V> M notEmpty(M map, String template, Object... args) { if (Maps.isEmpty(map)) { throw new IllegalArgumentException(Strings.format(template, args)); } return map; }
/** * Assert that a Map has entries; that is, it must not be <code>null</code> and must have at least * one entry. * * <pre class="code"> * Assert.notEmpty(map, "Map must have entries"); * </pre> * * @param map the map to check * @param message the exception message to use if the assertion fails * @throws IllegalArgumentException if the map is <code>null</code> or has no entries */ public static <M extends Map<K, V>, K, V> M notEmpty(M map, String message) { if (Maps.isEmpty(map)) { throw new IllegalArgumentException(message); } return map; }