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

10
LINES

< > BotCompany Repo | #1021693 // printMultiSet - print MultiSet in order of prevalence (uses toString)

JavaX fragment (include)

1  
static void printMultiSet(MultiSet ms) {
2  
  printMultiSet(ms, null);
3  
}
4  
5  
// renderer = func(O) -> S
6  
static void printMultiSet(MultiSet ms, O renderer) {
7  
  for (O o : ms.highestFirst())
8  
    print(ms.get(o) + ": " + (renderer != null ? callF(renderer, o) : str(o)));
9  
  print();
10  
}

Author comment

Began life as a copy of #1003757

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: #1021693
Snippet name: printMultiSet - print MultiSet in order of prevalence (uses toString)
Eternal ID of this version: #1021693/3
Text MD5: b9a6cab12740298ab13c53903910585b
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-02-24 15:24:02
Source code size: 286 bytes / 10 lines
Pitched / IR pitched: No / No
Views / Downloads: 326 / 339
Version history: 2 change(s)
Referenced in: [show references]