I have one List of totally 13 HashMaps in my input. Each HashMap has only 2 Keys "fieldName" and "accessibilityType" and corresponding values:
"fieldAccessibility": [
{
"fieldName": "firstName",
"accessibilityType": "EDITABLE"
},
{
"fieldName": "lastName",
"accessibilityType": "EDITABLE"
},
{
"fieldName": "avatarUrl",
"accessibilityType": "EDITABLE"
},
{
"fieldName": "username",
"accessibilityType": "EDITABLE"
},
{
"fieldName": "birthDate",
"accessibilityType": "EDITABLE"
},
{
"fieldName": "phoneNumbers",
"accessibilityType": "EDITABLE"
},
{
"fieldName": "email",
"accessibilityType": "EDITABLE"
},
{
"fieldName": "language",
"accessibilityType": "EDITABLE"
},
{
"fieldName": "externalId",
"accessibilityType": "EDITABLE"
},
{
"fieldName": "externalCode",
"accessibilityType": "EDITABLE"
},
{
"fieldName": "punchBadgeId",
"accessibilityType": "EDITABLE"
},
{
"fieldName": "minor",
"accessibilityType": "EDITABLE"
},
{
"fieldName": "seniorityDate",
"accessibilityType": "EDITABLE"
}
]
I am trying to iterate through this and change the value of "accessibilityType" into "READ" where "fieldName" is "birthDate". Can someone please say the efficient way to do this. This is my attempt so far to just read and print each key-value pair:
final List<HashMap<String, String>> list = some code to get the input;
for (HashMap<String, String> m : list)
{
for (HashMap.Entry<String, String> e : m.entrySet())
{
String key = e.getKey();
String value = e.getValue();
System.out.println("SEE HERE TEST " + key + " = " + value);
}}