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

14
LINES

< > BotCompany Repo | #1011312 // multiMapIndexByField

JavaX fragment (include)

// does not store null values
static MultiMap multiMapIndexByField(Collection c, S field) {
  new MultiMap map;
  for (O a : c) {
    O val = getOpt(a, field);
    if (val != null)
      map.put(val, a);
  }
  ret map;
}

static MultiMap mapMethodLike multiMapIndexByField(S field, Collection c) {
  ret multiMapIndexByField(c, field);
}

Author comment

Began life as a copy of #1002467

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1011312
Snippet name: multiMapIndexByField
Eternal ID of this version: #1011312/4
Text MD5: ecf4dacf245ca4f414a94a34cc3eff9f
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-12-31 23:50:03
Source code size: 350 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 517 / 581
Version history: 3 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1012273 - multiMapIndexByMethod
#1027804 - multiMapIndex
#1029712 - treeMultiMapIndexByField