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个回答

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

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

具体你要做什么不是很清楚,为什么合并以后的日期是12-03了。

建议你先看下这个:https://blog.csdn.net/beirdu/article/details/78585945

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐