commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emmanuel Bourg <ebo...@apache.org>
Subject Re: svn commit: r1559905 - in /commons/proper/csv/trunk/src: main/java/org/apache/commons/csv/CSVRecord.java test/java/org/apache/commons/csv/CSVRecordTest.java
Date Tue, 21 Jan 2014 07:38:12 GMT
Le 21/01/2014 03:12, ggregory@apache.org 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: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message