mirror of
https://github.com/apache/commons-csv.git
synced 2025-02-13 05:26:28 +00:00
Use own API
This commit is contained in:
parent
cce8f28fb9
commit
545f0670ee
@ -18,12 +18,12 @@
|
|||||||
package org.apache.commons.csv;
|
package org.apache.commons.csv;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -271,9 +271,8 @@ public final class CSVRecord implements Serializable, Iterable<String> {
|
|||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
getHeaderMapRaw().forEach((key, value) -> {
|
getHeaderMapRaw().forEach((key, value) -> {
|
||||||
final int col = value;
|
if (value < values.length) {
|
||||||
if (col < values.length) {
|
map.put(key, values[value]);
|
||||||
map.put(key, values[col]);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return map;
|
return map;
|
||||||
@ -308,10 +307,7 @@ public final class CSVRecord implements Serializable, Iterable<String> {
|
|||||||
* @since 1.9.0
|
* @since 1.9.0
|
||||||
*/
|
*/
|
||||||
public List<String> toList() {
|
public List<String> toList() {
|
||||||
// Only allocate a single list of known size
|
return stream().collect(Collectors.toList());
|
||||||
final ArrayList<String> list = new ArrayList<>(values.length);
|
|
||||||
Stream.of(values).forEach(list::add);
|
|
||||||
return list;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user