finding the smartest student without lambda
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class FindMaxNoLambda { | |
public static void main(String[] args) { | |
Set<Student> aSetOfStudents = initStudents(); | |
double maxGrade = Double.MIN_VALUE; | |
Student smartestStudent; | |
for(Student s: aSetOfStudents) { | |
if(2014 == s.getGraduationYear() && s.getGrade() > maxGrade) { | |
smartestStudent = s; | |
maxGrade = s.getGrade() | |
} | |
} | |
System.out.printf("Max grade: %s%n", maxGrade); | |
} | |
private static Set<Student> initStudents() { | |
//initialize a set of Student | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment