如何在现有列表

时间:2016-11-08 18:27:19

标签: java arraylist

List<Person> people = new ArrayList<Person>();

for (Person p : list) {   
Array person = new array[];   
personList.add(person);   

person.setName(list.getname);  
person.setLastname(list.getLastname);  
person.setAddress(list.address);

people.add(person);

在此代码中,我的地址有5行,如果我必须添加所有这些行到一个

示例,转换此

Name        LastName        Address
John        Smith           123
                            LakeViewDrive
                            Wheeling
                            chicago
                            illinois

Scott       Raible          456
                            Discovergateway
                            lakecook road
                            chicago
                            illinois

John        Smith           123 LakeviewDrive Wheeling chicago Illinois
scott       Raible          456 Discovergateway lakecook road chicago Illinois

请告诉我如何将地址行附加到单个值而不更改。

0 个答案:

没有答案