/** * Replaces the values for the given key with the given values. * * @param key The key * @param values The new values * @return This object */ public FluentStringsMap replace(final String key, final String... values) { return replace(key, Arrays.asList(values)); }
/** * Replace the values for all keys from the given map that are also present in this object, with the values from the given map. * All key-values from the given object that are not present in this object, will be added to it. * * @param src The source object * @return This object */ public FluentStringsMap replaceAll(FluentStringsMap src) { if (src != null) { for (Map.Entry<String, List<String>> header : src) { replace(header.getKey(), header.getValue()); } } return this; }
/** * Replace the values for all keys from the given map that are also present in this object, with the values from the given map. * All key-values from the given object that are not present in this object, will be added to it. * * @param src The source map * @return This object */ public FluentStringsMap replaceAll(Map<? extends String, ? extends Collection<String>> src) { if (src != null) { for (Map.Entry<? extends String, ? extends Collection<String>> header : src.entrySet()) { replace(header.getKey(), header.getValue()); } } return this; }
@Override public List<String> put(String key, List<String> value) { if (key == null) { throw new NullPointerException("Null keys are not allowed"); } List<String> oldValue = get(key); replace(key, value); return oldValue; }