public class User{
private int id;
private String name;
}
List userList= new ArrayList<>();
userList.add(new User(1, “小明”));
userList.add(new User(2, “小红”));
User user = userList.stream() .filter(user-> “小明”.equals(customer.getName())) .findAny() .orElse(null);
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)