Skip to content

Commit f9f9feb

Browse files
committed
[CSV-275] Make CSVRecord.toList() public.
1 parent 00fcb06 commit f9f9feb

3 files changed

Lines changed: 14 additions & 3 deletions

File tree

src/changes/changes.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
</properties>
4040
<body>
4141
<release version="1.9" date="2020-MM-DD" description="Feature and bug fix release (Java 8)">
42+
<!-- FIX -->
4243
<action type="add" dev="ggregory" due-to="dota17">Add test cases for CSVRecord with get(Enum) and toString. #54.</action>
4344
<action type="update" dev="ggregory" due-to="Amey Jadiye">Replace FindBugs with SpotBugs #56.</action>
4445
<action type="update" dev="ggregory" due-to="Chen">Javadoc typo in CSVFormat let's -> lets #57.</action>
@@ -57,6 +58,7 @@
5758
<action issue="CSV-267" type="fix" dev="ggregory" due-to="Arturo Bernal">Minor improvements #126, #127.</action>
5859
<action issue="CSV-123" type="fix" dev="ggregory" due-to="Emmanuel Bourg, Benedikt Ritter, shivakrishnaah, Gary Gregory">Add possibility to use ResultSet header meta data as CSV header #11.</action>
5960
<!-- ADD -->
61+
<action issue="CSV-275" type="add" dev="ggregory" due-to="Michael Wyraz, Gary Gregory">Make CSVRecord#toList() public.</action>
6062
<!-- UPDATE -->
6163
<action type="update" dev="ggregory" due-to="Gary Gregory">Update org.junit.jupiter:junit-jupiter from 5.6.0 to 5.7.0, #84 #109</action>
6264
<action type="update" dev="ggregory" due-to="Gary Gregory">Update tests from Apache Commons Lang 3.9 to 3.12.0.</action>

src/main/java/org/apache/commons/csv/CSVRecord.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import java.util.List;
2525
import java.util.Map;
2626
import java.util.Map.Entry;
27+
import java.util.stream.Stream;
2728
import java.util.Objects;
2829

2930
/**
@@ -291,11 +292,10 @@ public int size() {
291292
/**
292293
* Converts the values to a List.
293294
*
294-
* TODO: Maybe make this public?
295-
*
296295
* @return a new List
296+
* @since 1.9.0
297297
*/
298-
private List<String> toList() {
298+
public List<String> toList() {
299299
return Arrays.asList(values);
300300
}
301301

src/test/java/org/apache/commons/csv/CSVRecordTest.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,15 @@ public void testSerialization() throws IOException, ClassNotFoundException {
248248
}
249249
}
250250

251+
@Test
252+
public void testToList() {
253+
int i = 0;
254+
for (final String value : record.toList()) {
255+
assertEquals(values[i], value);
256+
i++;
257+
}
258+
}
259+
251260
@Test
252261
public void testToMap() {
253262
final Map<String, String> map = this.recordWithHeader.toMap();

0 commit comments

Comments
 (0)