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

9
LINES

< > BotCompany Repo | #1020575 // pairsToMapWithMultiSetValues

JavaX fragment (include)

1  
static <A, B> Map<A, MultiSet<B>> pairsToMapWithMultiSetValues(LPair<A, B> l) {
2  
  new Map<A, MultiSet<B>> mm;
3  
  for (Pair<A, B> p : unnull(l)) {
4  
    MultiSet<B> set = mm.get(p.a);
5  
    if (set == null) mm.put(p.a, set = new MultiSet);
6  
    set.add(p.b);
7  
  }
8  
  ret mm;
9  
}

Author comment

Began life as a copy of #1020568

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1020575
Snippet name: pairsToMapWithMultiSetValues
Eternal ID of this version: #1020575/1
Text MD5: b19be68acb382634b9a8670e5c67f664
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-12-27 02:18:41
Source code size: 275 bytes / 9 lines
Pitched / IR pitched: No / No
Views / Downloads: 226 / 268
Referenced in: [show references]