相关疑难解决方法(0)

Java 8流过滤器 - 基于排序的pdate

我试图在过滤器中对字段进行排序.

输入文件/样本记录:

DocumentList: [
    Document{
        {
            _id=5975ff00a213745b5e1a8ed9,
            u_id=,
            mailboxcontent_id=5975ff00a213745b5e1a8ed8,                
            idmapping=Document{
                {ptype=PDF, cid=00988, normalizedcid=00988, systeminstanceid=, sourceschemaname=, pid=0244810006}
            },
            batchid=null,
            pdate=Tue Jul 11 17:52:25 IST 2017, locale=en_US
        }
    },
    Document{
        {
            _id=597608aba213742554f537a6,
            u_id=,
            mailboxcontent_id=597608aba213742554f537a3, 
            idmapping=Document{
                {platformtype=PDF, cid=00999, normalizedcid=00999, systeminstanceid=, sourceschemaname=, pid=0244810006}
            },
            batchid=null,
            pdate=Fri Jul 28 01:26:22 IST 2017,
            locale=en_US
        }
    }
]
Run Code Online (Sandbox Code Playgroud)

在这里,我需要根据pdate进行排序.

List<Document> outList = documentList.stream()
    .filter(p -> p.getInteger(CommonConstants.VISIBILITY) == 1)
    .parallel()
    .sequential()
    .collect(Collectors.toCollection(ArrayList::new))
    .sort()
    .skip(skipValue)
    .limit(limtValue);
Run Code Online (Sandbox Code Playgroud)

不知道如何排序

"order by pdate DESC"
Run Code Online (Sandbox Code Playgroud)

先感谢您!

java sorting java-8 java-stream

2
推荐指数
1
解决办法
3839
查看次数

标签 统计

java ×1

java-8 ×1

java-stream ×1

sorting ×1