This method is a copy of addAll(Object, List) and it induces
a varargs warnings. Make it final, annotate it with @SafeVarArgs
and use Arrays.asList() to forward to addAll(Object, List).
This saves some code and fixes the warning.
Change-Id: I5d4ab405de168d54a0b941afdb28d13d6ed7dcef
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
*/
package org.opendaylight.restconf.common.util;
+import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedList;
}
@Override
- public void addAll(K key, V... newValues) {
- Objects.requireNonNull(newValues, "Supplied array of values must not be null.");
-
- if (newValues.length == 0) {
- return;
- }
-
- List<V> values = getValues(key);
- for (V value : newValues) {
- if (value != null) {
- values.add(value);
- }
- }
+ @SafeVarargs
+ public final void addAll(K key, V... newValues) {
+ addAll(key, Arrays.asList(newValues));
}
@Override