java数据聚合框架,Java数据聚合问题请教?

Java数据聚合问题

public class Demo {public static void main(String[] args) throws IOException {

HashMap m1 = new HashMap<>();

m1.put("month","2020-06");

m1.put("plan_working_hours",272.5);

m1.put("month_total_working_hours",120);

m1.put("project_code","ToB-APP");

m1.put("this_years_total_working_hours",287);

m1.put("project_name","B端APP框架");

m1.put("total_working_hours",307);

HashMap m2 = new HashMap<>();

m2.put("month","2020-07");

m2.put("plan_working_hours",272.5);

m2.put("month_total_working_hours",93);

m2.put("project_code","ToB-APP");

m2.put("this_years_total_working_hours",287);

m2.put("project_name","B端APP框架");

m2.put("total_working_hours",307);

HashMap m3 = new HashMap<>();

m3.put("month","2020-11");

m3.put("plan_working_hours",104);

m3.put("month_total_working_hours",16);

m3.put("project_code","1001");

m3.put("this_years_total_working_hours",67);

m3.put("project_name","C端底座");

m3.put("total_working_hours",150);

HashMap m4 = new HashMap<>();

m4.put("month","2020-12");

m4.put("plan_working_hours",104);

m4.put("month_total_working_hours",51);

m4.put("project_code","1001");

m4.put("this_years_total_working_hours",67);

m4.put("project_name","C端底座");

m4.put("total_working_hours",150);

ArrayList maps = new ArrayList<>();

maps.add(m1);

maps.add(m2);

maps.add(m3);

maps.add(m4);

//todo 做数据聚合(

// 将project_name值相同的数据中的month和month_total_working_hours聚合到一个list中

// 每个project_name只有一个map数据)

/**

* 格式如下

*

* {

* "monthList": ["2020-06":120 ,"2020-07":93]

* "plan_working_hours": 272.5,

* "project_code": "ToB-APP",

* "this_years_total_working_hours": 287,

* "project_name": "B端APP框架",

* "total_working_hours": 307

* },

*/

}

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值