Exemplo n.º 1
0
 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;
 }
Exemplo n.º 2
0
 /**
  * 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, &quot;Map must have entries&quot;);
  * </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;
 }