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

11
LINES

< > BotCompany Repo | #1018141 // stripMultiSetToTopTen

JavaX fragment (include)

static <A> MultiSet<A> stripMultiSetToTopTen(MultiSet<A> ms) {
  ret stripMultiSetToTopTen(10, ms);
}

static <A> MultiSet<A> stripMultiSetToTopTen(int n, MultiSet<A> ms) {
  if (ms == null) null;
  new MultiSet<A> ms2;
  for (Pair<A, Int> p : topTenPairs(ms, n))
    ms2.add(p.a, p.b);
  ret ms2;
}

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1018141
Snippet name: stripMultiSetToTopTen
Eternal ID of this version: #1018141/5
Text MD5: 36a8b0936ee28a5bc374dfb01aff88d9
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-07-21 01:39:16
Source code size: 309 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 387 / 427
Version history: 4 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)