I have a List<Person>
that I want to write to a CSV-file and then read it again. My problem is that the Person
-class have a List<Insurance>
-attribute. Therefor the line length will depend on how many objects are in the List<Insurance>
-attribute. A Person
can have 0 or multiple insurances and these are stored in a List
in the specific Person
. Is there a reasonable way of doing this?
Like this:
public class Person {
private int insuranceNR;
private String firstName;
private String lastName;
private List<Insurance> insurances;
}
I have failed to find questions like mine, but if there are please redirect me. Thanks.