Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

9
LINES

< > BotCompany Repo | #1022258 // nValuesFromMultiMapByKeyDesc

JavaX fragment (include)

1  
static <A, B> L<B> nValuesFromMultiMapByKeyDesc(int n, MultiMap<A, B> mm) {
2  
  new L<B> out;
3  
  for (A key : keysDesc(mm)) {
4  
    int need = n-l(out);
5  
    out.addAll(takeFirst(need, mm.get(key)));
6  
    if (l(out) >= n) break;
7  
  }
8  
  ret out;
9  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1022258
Snippet name: nValuesFromMultiMapByKeyDesc
Eternal ID of this version: #1022258/2
Text MD5: 744c937d37f74822d8204c9eb9ff80e1
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-03-12 12:39:47
Source code size: 246 bytes / 9 lines
Pitched / IR pitched: No / No
Views / Downloads: 302 / 323
Version history: 1 change(s)
Referenced in: [show references]