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

14
LINES

< > BotCompany Repo | #1029712 // treeMultiMapIndexByField

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (2796L/17K).

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

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

Author comment

Began life as a copy of #1011312

download  show line numbers  debug dex  old transpilations   

Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1029712
Snippet name: treeMultiMapIndexByField
Eternal ID of this version: #1029712/1
Text MD5: 9aad5c02f9d303dc9f227f6cb236afa7
Transpilation MD5: 52b16e2bd65e64a9ed15c2f45f441119
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-09-08 11:11:03
Source code size: 375 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 232 / 285
Referenced in: [show references]