I have object PayBill, that contains list of items. Object Item contains article. This article is connected to another Nomenclature object, which is stored as db table with next structure:
Article ProductGroup
------- ------------
010101 Telephone
040444 Computer
I parsed my transaction list into object Stat with next attributes: payBillNumber, productGroup, amountOfItems, sumPriceOfItems. Now list of Stat looks like:
BillNumber ProductGroup NumberOfItemsInBill SummaryItemsCostInBill
---------- ------------ ------------------- ----------------------
1 Telephone 1 1000
1 Computer 1 200
1 Telephone 2 2000
1 Computer 1 200
2 Accessories 1 1500
How can I collapse this List<Stat> into new List<Stat> with following view:
BillNumber ProductGroup NumberOfItemsInBill SummaryItemsCostInBill
---------- ------------ ------------------- ----------------------
1 Telephone 3 3000
1 Computer 2 400
2 Accessories 1 1500
I want my data to be grouped by BillNumber and ProductGroup with amount an price summing. Is it possible to do without creating new Map?