I have a json array list in below format in same order. I cannot expect the data in sorting , it may vary, Company-x may come in any order.
Company-1 - {Branch-1, Branch-4, Branch-8}
Company-2 - {Branch-9, Branch-11, Branch-22}
Company-4 - {Branch-45, Branch-64, Branch-18}
Company-1 - {Branch-10, Branch-43, Branch-82}
Company-2 - {Branch-15, Branch-44, Branch-86}
Also,this may increase more than 10,000 rows. I need to make a key value pair without affecting the performance. I need to store above data in HashMap. (Map < String, List < Branch > ).
For example I need result as below format :
[Company-1,{Branch-1, Branch-4, Branch-8,Branch-10, Branch-43, Branch-82}]
[Company-2,{Branch-9, Branch-11, Branch-22,Branch-15, Branch-44, Branch-86}]
[Company-4,{Branch-45, Branch-64, Branch-18}]
....etc.
How to achieve this in java ?
Here is the json format. Key is CID and Values are (Branch_ID and Names)
[
{
"CID": "4545",
"BRANCH_ID": "0041",
"Name": "BID41",
},
{
"ID": "4546",
"BRANCH_ID": "0051",
"Name": "BID51",
},
{
"ID": "4545",
"BRANCH_ID": "0042",
"Name": "BID42",
},
{
"ID": "4546",
"BRANCH_ID": "0052",
"Name": "BID52",
},
{
"ID": "4545",
"BRANCH_ID": "0043",
"Name": "BID43",
},
{
"ID": "4545",
"BRANCH_ID": "0053",
"Name": "BID53",
}
]