I have class student as below
class Student{
Map<String,Integer> subjectMarks;
String name;
public Student(Map<String,Integer> subject, String name) {
super();
this.subjectMarks = subject;
this.name = name;
}
public Map<String,Integer> getSubjectMarks() {
return subjectMarks;
}
public void setSubjectMarks(Map<String,Integer> subject) {
this.subjectMarks = subject;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
In main method we add student object in arraylist as follow.
ArrayList<Student> arr = new ArrayList<Student>();
Map m1 = new HashedMap();
m1.put("Maths",40);
m1.put("Science",50);
Map m2 = new HashedMap();
m2.put("Maths",60);
m2.put("Science",20);
arr.add(new Student(m1, "RAJ"));
arr.add(new Student(m2, "AMIT"));
can some help/guide me to find average marks of subject for each student and then get maximum from averge. I want help to write this snippet in java8