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

9
LINES

< > BotCompany Repo | #1020575 // pairsToMapWithMultiSetValues

JavaX fragment (include)

static <A, B> Map<A, MultiSet<B>> pairsToMapWithMultiSetValues(LPair<A, B> l) {
  new Map<A, MultiSet<B>> mm;
  for (Pair<A, B> p : unnull(l)) {
    MultiSet<B> set = mm.get(p.a);
    if (set == null) mm.put(p.a, set = new MultiSet);
    set.add(p.b);
  }
  ret mm;
}

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: 224 / 265
Referenced in: [show references]