* @param values
* A list of values TODO: see if using an iterator for the values is more efficient
*/
public static <T> void mapStringList(final Map<String, T> destination, final String[] nameMapper, final List<T> values) {
if( nameMapper.length != values.size() ) {
throw new SuperCSVException(
"The namemapper array and the value list must match in size. Number of columns mismatch number of entries for your map.");
}
destination.clear();
// map each element of the array
for( int i = 0; i < nameMapper.length; i++ ) {
final String key = nameMapper[i];
// null's in the name mapping means skip column
if( key == null ) {
continue;
}
// only perform safe inserts
if( destination.containsKey(key) ) {
throw new SuperCSVException("nameMapper array contains duplicate key \"" + key
+ "\" cannot map the list");
}
destination.put(key, values.get(i));
}