Libraryless. Click here for Pure Java version (2136L/14K).
// does not store null values static Map indexByField(Iterable c, S field) { new HashMap map; for (O a : c) { O val = getOpt(a, field); if (val != null) map.put(val, a); } ret map; } static Map mapMethodLike indexByField(S field, Iterable c) { ret indexByField(c, field); }
Began life as a copy of #1002318
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1002467 |
| Snippet name: | indexByField - returns HashMap. doesn't store null values |
| Eternal ID of this version: | #1002467/5 |
| Text MD5: | 393325eed264686cbe7de118c03c4b58 |
| Transpilation MD5: | 8050fdd5300932e630c8ea8ed04b1299 |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2019-02-28 15:12:27 |
| Source code size: | 311 bytes / 14 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 1153 / 1250 |
| Version history: | 4 change(s) |
| Referenced in: | [show references] |