OpenCSV - How to map selected columns to Java Bean regardless of order?

前端 未结 10 907
终归单人心
终归单人心 2020-11-30 06:38

I have a CSV file with the following columns: id, fname, telephone, lname, address.

I have a P

10条回答
  •  独厮守ぢ
    2020-11-30 06:59

    SimpleFlatMapper can do that easily see Getting Started csv using the headers of the csv or by manually specifying which columns map to what property.

    CsvParser
        .mapTo(MyObject.class)
        .forEach(file, System.out::println);
    

提交回复
热议问题