I have an array list of objects and I want to update my array-list with new data but, I get an error "Could not deserialize object. Expected a List, but got a class java.util.HashMap (found in field 'students')"
Here's the method that's responsible for updating the arraylist
private void update(){
Map<String, Object> updatedlist = new HashMap<>();
for(int i=0; i<studentsList.size(); i++){
updatedlist.put("name", studentsList.get(i).getName());
updatedlist.put("id", studentsList.get(i).getId());
updatedlist.put("attended", studentsList.get(i).isAttended());
}
DocumentReference document = db.collection("Records").document(rid);
document.update("students", updatedlist);
}
for clarification, studentslist is an arraylist of students object ( List < students > studentslist ) I tried converting the array-list to a hash-map as well as updating the list as an array-list but I got an error from both ways.