Here you can find the source of putMapEntry(Map
Parameter | Description |
---|---|
map | The map to populate |
name | The parameter name |
value | The parameter value |
private static void putMapEntry(Map<String, String[]> map, String name, String value)
//package com.java2s; //License from project: Open Source License import java.util.Map; public class Main { /***//from ww w. j a va 2 s. c om * Put name and value pair in map. When name already exist, add value * to array of values. * * @param map The map to populate * @param name The parameter name * @param value The parameter value */ private static void putMapEntry(Map<String, String[]> map, String name, String value) { String[] newValues = null; String[] oldValues = map.get(name); if (oldValues == null) { newValues = new String[1]; newValues[0] = value; } else { newValues = new String[oldValues.length + 1]; System.arraycopy(oldValues, 0, newValues, 0, oldValues.length); newValues[oldValues.length] = value; } map.put(name, newValues); } }