public FluentStringsMap(FluentStringsMap src) { if (src != null) { for (Map.Entry<String, List<String>> header : src) { add(header.getKey(), header.getValue()); } } }
public FluentStringsMap(Map<String, Collection<String>> src) { if (src != null) { for (Map.Entry<String, Collection<String>> header : src.entrySet()) { add(header.getKey(), header.getValue()); } } }
/** * Adds all key-values pairs from the given map to this object and returns this object. * * @param src The source map * @return This object */ public FluentStringsMap addAll(Map<String, Collection<String>> src) { if (src != null) { for (Map.Entry<String, Collection<String>> header : src.entrySet()) { add(header.getKey(), header.getValue()); } } return this; }
/** * Adds all key-values pairs from the given object to this object and returns this object. * * @param src The source object * @return This object */ public FluentStringsMap addAll(FluentStringsMap src) { if (src != null) { for (Map.Entry<String, List<String>> header : src) { add(header.getKey(), header.getValue()); } } return this; }
/** * Adds the specified values and returns this object. * * @param key The key * @param values The value(s); if the array is null then this method has no effect * @return This object */ public FluentStringsMap add(String key, String... values) { if (isNonEmpty(values)) { add(key, Arrays.asList(values)); } return this; }
public FluentStringsMap(FluentStringsMap src) { if (src != null) { for (Map.Entry<String, List<String>> header : src) { add(header.getKey(), header.getValue()); } } }
public FluentStringsMap(FluentStringsMap src) { if (src != null) { for (Map.Entry<String, List<String>> header : src) { add(header.getKey(), header.getValue()); } } }
/** * Adds all key-values pairs from the given object to this object and returns this object. * * @param src The source object * @return This object */ public FluentStringsMap addAll(FluentStringsMap src) { if (src != null) { for (Map.Entry<String, List<String>> header : src) { add(header.getKey(), header.getValue()); } } return this; }
/** * Adds all key-values pairs from the given object to this object and returns this object. * * @param src The source object * @return This object */ public FluentStringsMap addAll(FluentStringsMap src) { if (src != null) { for (Map.Entry<String, List<String>> header : src) { add(header.getKey(), header.getValue()); } } return this; }
public FluentStringsMap(Map<String, Collection<String>> src) { if (src != null) { for (Map.Entry<String, Collection<String>> header : src.entrySet()) { add(header.getKey(), header.getValue()); } } }
public FluentStringsMap(FluentStringsMap src) { if (src != null) { for (Map.Entry<String, List<String>> header : src) { add(header.getKey(), header.getValue()); } } }
public FluentStringsMap(Map<String, Collection<String>> src) { if (src != null) { for (Map.Entry<String, Collection<String>> header : src.entrySet()) { add(header.getKey(), header.getValue()); } } }
public FluentStringsMap(Map<String, Collection<String>> src) { if (src != null) { for (Map.Entry<String, Collection<String>> header : src.entrySet()) { add(header.getKey(), header.getValue()); } } }
/** * Adds all key-values pairs from the given map to this object and returns this object. * * @param src The source map * @return This object */ public FluentStringsMap addAll(Map<String, Collection<String>> src) { if (src != null) { for (Map.Entry<String, Collection<String>> header : src.entrySet()) { add(header.getKey(), header.getValue()); } } return this; }
/** * Adds all key-values pairs from the given map to this object and returns this object. * * @param src The source map * @return This object */ public FluentStringsMap addAll(Map<String, Collection<String>> src) { if (src != null) { for (Map.Entry<String, Collection<String>> header : src.entrySet()) { add(header.getKey(), header.getValue()); } } return this; }
/** * Adds the specified values and returns this object. * * @param key The key * @param values The value(s); if the array is null then this method has no effect * @return This object */ public FluentStringsMap add(String key, String... values) { if (isNonEmpty(values)) { add(key, Arrays.asList(values)); } return this; }
/** * Adds the specified values and returns this object. * * @param key The key * @param values The value(s); if the array is null then this method has no effect * @return This object */ public FluentStringsMap add(String key, String... values) { if (isNonEmpty(values)) { add(key, Arrays.asList(values)); } return this; }
/** * Adds the specified values and returns this object. * * @param key The key * @param values The value(s); if the array is null then this method has no effect * @return This object */ public FluentStringsMap add(String key, String... values) { if (isNonEmpty(values)) { add(key, Arrays.asList(values)); } return this; }
@Test public void nullValueTest() { FluentStringsMap map = new FluentStringsMap(); map.add("foo", (String) null); assertEquals(map.getFirstValue("foo"), null); assertEquals(map.getJoinedValue("foo", ", "), null); assertEquals(map.get("foo").size(), 1); }
@Test public void emptyValueTest() { FluentStringsMap map = new FluentStringsMap(); map.add("foo", ""); assertEquals(map.keySet(), new LinkedHashSet<>(Arrays.asList("foo"))); assertEquals(map.getFirstValue("foo"), ""); assertEquals(map.getJoinedValue("foo", ", "), ""); assertEquals(map.get("foo"), Arrays.asList("")); }