I am having below ArrayList and wanted to split and create sublists and keep those in hashmap.Can anyone help.
public class SomeClass{
private String appNo;
private String status;
private String userName;
}
ArrayList:
[
{
"appNo":"123",
"status":"done",
"userName":"abc"
},
{
"appNo":"123",
"status":"pending",
"userName":"aaa"
},
{
"appNo":"234",
"status":"pending",
"userName":"aaa"
}
]
now i need to create sublist and entries against the appNo.
and i am expecting the output like below(with HashMap)
HashMap map = new HashMap<String,List<SomeClass>>();
and here string is the appNo and corresponding same appNo entries needs to keep it the list.
map key : 123
value : list of 2 entries having the 123 appNo
map key : 234
value : list of 1 entry having the 234 appNO