private static void putMapEntry ( final Map < String , String [ ] > map , final String name , final String value ) { String [ ] newValues = null ; final 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 ) ; }
Put name and value pair in map . When name already exist add value to array of values .