In this version, a new method is now available in order to generate a top K.
Very useful if you want to display a ranking !
example :
Code (Java):
Comparator
<PlayerEntity
> comparator
=
(o1, o2
)
-> o2.
getScore
(
)
- o1.
getScore
(
)
;
repository.
computeTopAsync
(
3, comparator
)
.
thenAsync
(
(playerEntities
)
->
{
playerEntities.
get
(
0
)
;
// TOP 1
playerEntities.
get
(
1
)
;
// TOP 2
playerEntities.
get
(
2
)
;
// TOP 3
}
)
;