2929 */
3030public class CSVRecord implements Serializable , Iterable <String > {
3131
32- private static final long serialVersionUID = 1L ;
33-
3432 private static final String [] EMPTY_STRING_ARRAY = new String [0 ];
3533
36- /** The values of the record */
37- private final String [] values ;
38-
39- /** The column name to index mapping. */
40- private final Map <String , Integer > mapping ;
34+ private static final long serialVersionUID = 1L ;
4135
4236 /** The accumulated comments (if any) */
4337 private final String comment ;
4438
39+ /** The column name to index mapping. */
40+ private final Map <String , Integer > mapping ;
41+
4542 /** The record number. */
4643 private final long recordNumber ;
4744
45+ /** The values of the record */
46+ private final String [] values ;
47+
4848 CSVRecord (final String [] values , final Map <String , Integer > mapping ,
4949 final String comment , final long recordNumber ) {
5050 this .recordNumber = recordNumber ;
@@ -103,6 +103,25 @@ public String get(final String name) {
103103 }
104104 }
105105
106+ /**
107+ * Returns the comment for this record, if any.
108+ *
109+ * @return the comment for this record, or null if no comment for this
110+ * record is available.
111+ */
112+ public String getComment () {
113+ return comment ;
114+ }
115+
116+ /**
117+ * Returns the number of this record in the parsed CSV file.
118+ *
119+ * @return the number of this record.
120+ */
121+ public long getRecordNumber () {
122+ return recordNumber ;
123+ }
124+
106125 /**
107126 * Returns true if this record is consistent, false if not. Currently, the only check is matching the record size to
108127 * the header size. Some programs can export files that fails this test but still produce parsable files.
@@ -145,29 +164,6 @@ public Iterator<String> iterator() {
145164 return Arrays .asList (values ).iterator ();
146165 }
147166
148- String [] values () {
149- return values ;
150- }
151-
152- /**
153- * Returns the comment for this record, if any.
154- *
155- * @return the comment for this record, or null if no comment for this
156- * record is available.
157- */
158- public String getComment () {
159- return comment ;
160- }
161-
162- /**
163- * Returns the number of this record in the parsed CSV file.
164- *
165- * @return the number of this record.
166- */
167- public long getRecordNumber () {
168- return recordNumber ;
169- }
170-
171167 /**
172168 * Returns the number of values in this record.
173169 *
@@ -182,5 +178,9 @@ public String toString() {
182178 return Arrays .toString (values );
183179 }
184180
181+ String [] values () {
182+ return values ;
183+ }
184+
185185
186186}
0 commit comments