1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
| @Data public class User{ private Integer id; private String name; private String sex; private Integer age; private String department; private BigDecimal salary; public User(){
} public User(Integer id,String name,String sex,Integer age,String department,BigDecimal salary){ this.id=id; this.name=name; this.sex=sex; this.age=age; this.department=department; this.salary=salary; } }
public class ListStream{
public static void main(String [] args){ List<User> userList = getUserList(); }
public static List<User> getUserList(){ List<User> userList = new ArrayList<User>(); userList.add(new User(1, "黄文隆", "男", 32, "研发部", BigDecimal.valueOf(3600))); userList.add(new User(2, "江奕云", "男", 30, "财务部", BigDecimal.valueOf(3800))); userList.add(new User(3, "刘姿婷", "女", 20, "人事部", BigDecimal.valueOf(3700))); userList.add(new User(4, "夏志豪", "男", 38, "研发部", BigDecimal.valueOf(3500))); userList.add(new User(5, "林雅南", "女", 25, "财务部", BigDecimal.valueOf(3200))); return userList; } }
|