File tree Expand file tree Collapse file tree
src/main/java/org/apache/commons/csv Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1818package org .apache .commons .csv ;
1919
2020import java .io .Serializable ;
21- import java .util .ArrayList ;
2221import java .util .Arrays ;
2322import java .util .Iterator ;
2423import java .util .LinkedHashMap ;
2524import java .util .List ;
2625import java .util .Map ;
26+ import java .util .stream .Collectors ;
2727import java .util .stream .Stream ;
2828
2929/**
@@ -271,9 +271,8 @@ public <M extends Map<String, String>> M putIn(final M map) {
271271 return map ;
272272 }
273273 getHeaderMapRaw ().forEach ((key , value ) -> {
274- final int col = value ;
275- if (col < values .length ) {
276- map .put (key , values [col ]);
274+ if (value < values .length ) {
275+ map .put (key , values [value ]);
277276 }
278277 });
279278 return map ;
@@ -308,10 +307,7 @@ public Stream<String> stream() {
308307 * @since 1.9.0
309308 */
310309 public List <String > toList () {
311- // Only allocate a single list of known size
312- final ArrayList <String > list = new ArrayList <>(values .length );
313- Stream .of (values ).forEach (list ::add );
314- return list ;
310+ return stream ().collect (Collectors .toList ());
315311 }
316312
317313 /**
You can’t perform that action at this time.
0 commit comments