Voiss 2018-12-05 04:12 采纳率: 0%
浏览 1313
已结题

JAVA一个复合的LIST如何合并

List<Map<String, Object>>

[
        {
            "todaysharecount": 0,
            "activetime": "2018-12-03",
            "todayjoincount": 0,
            "todayactivecount": 1
        },
        {
            "sharetime": "2018-12-05",
            "todayjoincount": 0,
            "todaysharecount": 2,
            "todayactivecount": 9,
            "activetime": "2018-12-05"
        },
        {
            "todayjoincount": 0,
            "todaysharecount": 2,
            "sharetime": "2018-11-29",
            "todayactivecount": 0
        },
        {
            "todayjoincount": 0,
            "todaysharecount": 2,
            "sharetime": "2018-12-01",
            "todayactivecount": 0
        },
        {
            "todayjoincount": 0,
            "todaysharecount": 2,
            "sharetime": "2018-12-02",
            "todayactivecount": 0
        },
        {
            "todaysharecount": 0,
            "todayjoincount": 4,
            "jointime": "2018-11-23",
            "todayactivecount": 0
        },
        {
            "todaysharecount": 0,
            "todayjoincount": 1,
            "jointime": "2018-11-27",
            "todayactivecount": 0
        },
        {
            "todaysharecount": 0,
            "jointime": "2018-11-30",
            "todayjoincount": 4,
            "todayactivecount": 0
        },
        {
            "todaysharecount": 0,
            "todayjoincount": 2,
            "jointime": "2018-12-03",
            "todayactivecount": 0
        }
    ]

这样一个LIST 怎么做到合并日期 每个Map里值大概都是这样 按照日期排序

    {
                    "time": "2018-12-03",
        "todaysharecount": 0,
        "todayjoincount": 2,
        "todayactivecount": 0
    }

展开全部

  • 写回答

2条回答 默认 最新

  • 爱码少年 00fly.online 2018-12-05 17:11
    关注

    简单来说:构造一个以时间yyyy-MM-dd为key,包含

    "time": "2018-12-03",
    "todaysharecount": 0,
    "todayjoincount": 2,
    "todayactivecount": 0
    值内容的ConcurrentHashMap,遍历复合List,来操作Map,具体的操作不是太难就不详细展开了!

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)
编辑
预览

报告相同问题?

手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部