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).

1  
// does not store null values
2  
static MultiMap treeMultiMapIndexByField(Collection c, S field) {
3  
  MultiMap map = treeMultiMap();
4  
  for (O a : c) {
5  
    O val = getOpt(a, field);
6  
    if (val != null)
7  
      map.put(val, a);
8  
  }
9  
  ret map;
10  
}
11  
12  
static MultiMap mapMethodLike treeMultiMapIndexByField(S field, Collection c) {
13  
  ret treeMultiMapIndexByField(c, field);
14  
}

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