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

9
LINES

< > BotCompany Repo | #1020568 // pairsToMapWithSetValues

JavaX fragment (include)

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

Author comment

Began life as a copy of #1020567

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: #1020568
Snippet name: pairsToMapWithSetValues
Eternal ID of this version: #1020568/2
Text MD5: 4047fe22c2770e3deb4eb1f2466cff12
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-12-27 01:25:48
Source code size: 254 bytes / 9 lines
Pitched / IR pitched: No / No
Views / Downloads: 220 / 258
Version history: 1 change(s)
Referenced in: [show references]