I have a List:
List<StudentBean> resultList
StudentBean has something like with getters and setters:
{ Integer StudentId, String StudentName, String Section}
.
I have a map with values: Map<Integer, StudentBean> orginialStudentDetails
Now I want to add/replace the values from resultList to orginialStudentDetails, how can I achieve that?
Tried:
for (Map.Entry<Integer, StudentBean> entry : resultList .size()){
orginialStudentDetails.put(entry.getKey(), resultList );
}
In addition to Joxtacy's correct approach:
resultList.forEach(s -> originalStudentDetails.put(s.getStudentId(), s));