/** * Shorthand version of putAll * @param input the input map */ public void putAllValues(Map<String, V> input) { for(Map.Entry<String,V> entry: input.entrySet()) { put(entry.getKey(), entry.getValue()); } }
/** * Put multi valued entry. * @param name The entry key. * @param value The simple value * @return The previous value or null. */ public List<V> put(String name, V value) { if(value == null) { return super.put(name, null); } List<V> vals = new ArrayList<>(); vals.add(value); return put(name,vals); }
/** Add values to multi valued entry. * If the entry is single valued, it is converted to the first * value of a multi valued entry. * @param name The entry key. * @param values The String array of multiple values. */ public void addValues(String name, V[] values) { List<V> lo = get(name); if(lo == null) { lo = new ArrayList<>(); } lo.addAll(Arrays.asList(values)); put(name,lo); }
/** Add values to multi valued entry. * If the entry is single valued, it is converted to the first * value of a multi valued entry. * @param name The entry key. * @param values The List of multiple values. */ public void addValues(String name, List<V> values) { List<V> lo = get(name); if(lo == null) { lo = new ArrayList<>(); } lo.addAll(values); put(name,lo); }
/** Remove value. * @param name The entry key. * @param value The entry value. * @return true if it was removed. */ public boolean removeValue(String name,V value) { List<V> lo = get(name); if((lo == null)||(lo.isEmpty())) { return false; } boolean ret = lo.remove(value); if(lo.isEmpty()) { remove(name); } else { put(name,lo); } return ret; }
headers.put(key, value); if (key.equalsIgnoreCase("content-disposition")) contentDisposition=value;
// create multimap to store key and values MultiMap multiMap = new MultiValueMap(); // put values into map for segment multiMap.put("segment", "1"); multiMap.put("segment", "100"); // put values into map for subDepartment multiMap.put("subDepartment", "2"); multiMap.put("subDepartment", "200"); // put values into map for officerTitle multiMap.put("officerTitle", "3"); multiMap.put("officerTitle", "300");
/** * Shorthand version of putAll * @param input the input map */ public void putAllValues(Map<String, V> input) { for(Map.Entry<String,V> entry: input.entrySet()) { put(entry.getKey(), entry.getValue()); } }
/** * Shorthand version of putAll * @param input the input map */ public void putAllValues(Map<String, V> input) { for(Map.Entry<String,V> entry: input.entrySet()) { put(entry.getKey(), entry.getValue()); } }
/** * Shorthand version of putAll * @param input the input map */ public void putAllValues(Map<String, V> input) { for(Map.Entry<String,V> entry: input.entrySet()) { put(entry.getKey(), entry.getValue()); } }
/** * Shorthand version of putAll * @param input the input map */ public void putAllValues(Map<String, V> input) { for(Map.Entry<String,V> entry: input.entrySet()) { put(entry.getKey(), entry.getValue()); } }
@Override public void parsedField(String key, String value) { // Add to headers and mark if one of these fields. // headers.put(StringUtil.asciiToLowerCase(key), value); if (key.equalsIgnoreCase("content-disposition")) contentDisposition = value; else if (key.equalsIgnoreCase("content-type")) contentType = value; // Transfer encoding is not longer considers as it is deprecated as per // https://tools.ietf.org/html/rfc7578#section-4.7 }
@Override public void parsedField(String key, String value) { // Add to headers and mark if one of these fields. // headers.put(StringUtil.asciiToLowerCase(key), value); if (key.equalsIgnoreCase("content-disposition")) contentDisposition = value; else if (key.equalsIgnoreCase("content-type")) contentType = value; // Transfer encoding is not longer considers as it is deprecated as per // https://tools.ietf.org/html/rfc7578#section-4.7 }
MultiMap stateCityMap= new MultiHashMap(); String state; String city; while ((line=br.readLine())!=null){ state=line.split("-")[0]; city=line.split("-")[1]; stateCityMap.put(state, city); }
MultiMap mhm = new MultiHashMap(); for ( string line: array) { String []pair = line.split(" "); mhm.put(pair[0],pair[1]); } for (Collection coll = (Collection) mhm.values() ) { //print all values from collection? }