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

14
LINES

< > BotCompany Repo | #1018369 // indexFieldAsCIMap

JavaX fragment (include)

1  
// does not store null values
2  
static <A> Map<S, A> indexFieldAsCIMap(Iterable<A> c, S field) {
3  
  Map<S, A> map = ciMap();
4  
  for (A a : unnull(c)) {
5  
    S val = getString(a, field);
6  
    if (val != null)
7  
      map.put(val, a);
8  
  }
9  
  ret map;
10  
}
11  
12  
static <A> Map<S, A> indexFieldAsCIMap(S field, Iterable<A> c) {
13  
  ret indexFieldAsCIMap(c, field);
14  
}

Author comment

Began life as a copy of #1002467

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1018369
Snippet name: indexFieldAsCIMap
Eternal ID of this version: #1018369/1
Text MD5: d4e55cc8641947420fa98ffd87e74d36
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-09-20 15:30:45
Source code size: 357 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 234 / 282
Referenced in: [show references]