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

14
LINES

< > BotCompany Repo | #1018369 // indexFieldAsCIMap

JavaX fragment (include)

// does not store null values
static <A> Map<S, A> indexFieldAsCIMap(Iterable<A> c, S field) {
  Map<S, A> map = ciMap();
  for (A a : unnull(c)) {
    S val = getString(a, field);
    if (val != null)
      map.put(val, a);
  }
  ret map;
}

static <A> Map<S, A> indexFieldAsCIMap(S field, Iterable<A> c) {
  ret indexFieldAsCIMap(c, field);
}

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