java中的数据分组
class UserControllerTest {
@Data
class User{
String name;
Integer age;
Integer gender;
public User(String name, Integer age, Integer gender){
this.name = name;
this.age = age;
this.gender = gender;
}
}
/**
* java中对数据进行分组
* 简单实体类User,成员属性 name,age,gender
*/
@Test
void dataGroup(){
// 1.一组提供的数据
List<User> users = new ArrayList<>();
users.add(new User("张三",18,1));
users.add(new User("李四",19,0));
users.add(new User("王五"