I have 400 players with 4 different skills I want to group them by skill but take only 20 from each skill
players.groupBy {
it.skill
}
So the total is 80 i.e 20 from each
CodePudding user response:
players.groupBy {
it.skill
}.mapValues{
it.value.take(20)
}