I got a list of pairs that I want to sorted by the left field, I succeed to do it and to get the 25 first element but now the problem is that I want to collect the right element into a list (or even both of them) but I don't know how to do it there is a problem with the toList()
.
return listOfTokens.stream()
.sorted((o1, o2) -> Double.compare(o1.getLeft().getCompare(terms.field.docCount),
o2.getLeft().getTfIdf(terms.fielddocCount)))
.limit(25)
.collect(toList());
If you want to collect just the right element, use
map
:If you want to collect both the right and left: