import ;
import ;
import ;
@Data
@Accessors(chain = true)
public class Student implements Serializable {
private static final long serialVersionUID = 1L;
private String name; // 名字
private int age; // 年龄
private String sex; //性别
private String address; // 地址
}
public static void main(String[] args) {
List<Student> studentList = new ArrayList<>();
Student student1 = new Student();
("张三");
(12);
("男");
("北京");
(student1);
Student student2 = new Student();
("李四");
(15);
("男");
("上海");
(student1);
Student student3 = new Student();
("王五");
(22);
("男");
("长沙");
(student1);
List<String> strList = ().map((Student student) -> {
(() + "-" + () + "-" + () + "-" + ());
return student;
}).map(row -> ()).collect(());
(strList);
}
- 输出结果:[张三-12-男-北京, 张三-12-男-北京-12-男-北京, 张三-12-男-北京-12-男-北京-12-男-北京]
- 参考文章:你算哪块小饼干咯_JAVA基础,小问题,企业微信-****博客