使用object中的date属性对基于月份的对象进行分组

时间:2017-05-25 07:19:42

标签: java sorting date

我需要根据月份对对象进行分组。我调用一个服务,该服务返回具有日期属性(在下面的响应中为RegisteredOn)的对象列表。现在我需要根据月份对这些对象进行分组。

输出应为:

January 2017
object1
object2

Feburary 2017
Object3
Object4

以下是服务回复:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/>
<SOAP-ENV:Body>
    <QueryLeadsResponseMessage schemaVersion="1.0" xmlns="http://schemas.discovery.co.za/leads" xmlns:ns0="http://schemas.discovery.co.za/leads/wellness">
        <LeadProfile>
            <LeadReferenceNumber>16997345</LeadReferenceNumber>
            .............
            <RegisteredOn>2017-01-19T14:08:21.000+02:00</RegisteredOn>
            <LeadProduct>
                ----------
            </LeadProduct>
        </LeadProfile>
        <LeadProfile>
            --------
            <RegisteredOn>2017-01-19T14:09:05.000+02:00</RegisteredOn>
            <LeadProduct>
                ---------
            </LeadProduct>
        </LeadProfile>

        <LeadProfile>
            --------
            <RegisteredOn>2017-02-19T14:09:05.000+02:00</RegisteredOn>
            <LeadProduct>
                ---------
            </LeadProduct>
        </LeadProfile>

        <LeadProfile>
            --------
            <RegisteredOn>2017-02-19T14:09:05.000+02:00</RegisteredOn>
            <LeadProduct>
                ---------
            </LeadProduct>
        </LeadProfile>


    </QueryLeadsResponseMessage>
</SOAP-ENV:Body>

0 个答案:

没有答案