我有一个物品 list ,里面有物品 list .对象项包含文章.本文连接到另一个命名对象,该对象存储为具有下一个 struct 的db表:
Article ProductGroup
------- ------------
010101 Telephone
040444 Computer
我将我的事务列表解析为具有以下属性的对象统计:payBillNumber
、productGroup
、amountOfItems
、sumPriceOfItems
.现在,Stat
人的名单如下所示:
BillNumber ProductGroup NumberOfItemsInBill SummaryItemsCostInBill
---------- ------------ ------------------- ----------------------
1 Telephone 1 1000
1 Computer 1 200
1 Telephone 2 2000
1 Computer 1 200
2 Accessories 1 1500
如何使用以下视图将此List<Stat>
折叠为新的List<Stat>
:
BillNumber ProductGroup NumberOfItemsInBill SummaryItemsCostInBill
---------- ------------ ------------------- ----------------------
1 Telephone 3 3000
1 Computer 2 400
2 Accessories 1 1500
我希望我的数据按BillNumber和ProductGroup进行分组,金额为价格总和.可以不创建新 map 吗?