Le 21/01/2014 03:12, [email protected] a écrit :
> /**
> + * Puts all values of this record into the given Map.
> + *
> + * @param map The Map to populate.
> + * @return the given map.
> + */
> + public Map<String, String> putIn(Map<String, String> map) {
> + for (Entry<String, Integer> entry : mapping.entrySet()) {
> + map.put(entry.getKey(), values[entry.getValue().intValue()]);
> + }
> + return map;
> + }
If you don't mind Gary I'd rather keep CSVRecord minimal and hide or
remove putIn().
> + /**
> + * Converts this record into a Map.
> + *
> + * @return A new Map. The map is empty if the record has no headers.
> + */
> + public Map<String, String> toMap() {
> + return putIn(new HashMap<String, String>(values.length));
> + }
I wonder if it would make sense to return a read only wrapper around the
record instead.
Emmanuel Bourg
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]