как найти максимальное значение в ArraList используя лямбда выражение без stream?
Есть ИНТЕРФЕЙС
interface BestStudent{
Student theBest(ArrayList<Student> students);
}
Class Student с Getter setter
public class Student{
String fullName;
int age;
double gpa;
int height;
public Student(String fullName, int age, double gpa, int height) {
this.fullName = fullName;
this.age = age;
this.gpa = gpa;
this.height = height;
}
public String getFullName() {
return fullName;
}
public void setFullName(String fullName) {
this.fullName = fullName;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public double getGpa() {
return gpa;
}
public void setGpa(double gpa) {
this.gpa = gpa;
}
public int getHeight() {
return height;
}
public void setHeight(int height) {
this.height = height;
}
}
Class StudentsAwards
class StudentAwards{
Student theMostGPA(ArrayList<Student> students){
BestStudent bestStudent=(ArrayList<Student> students1) -> {
double max = students.get(0).getGpa();
return students1.;
};
return bestStudent.theBest(students);
}
В классе StudentAwards написал метод Student theMostGPA(ArrayList<Student> students)
то есть он выводит студента из списка у кого самый высокий GPA. Как написать условие?