I have a List of Students that I want to convert to a List of Maps with each map containing specifc student data.
The Student Object:
class Student {
String name;
String age;
String getName() {
return name;
}
}
I have a list of Students that I want to convert to a list of maps that should look like the following:
[
{ name: "Mike",
age: "14"
},
{ name: "Jack",
age: "10"
},
{ name: "John",
age: "16"
},
{ name: "Paul",
age: "12"
}
]
Is there a way to convert List<Student> into List<Map<String, String>> ? The keys of each map should be name & age.