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

14
LINES

< > BotCompany Repo | #1014123 // consequentsMap - automatically ignores nulls

JavaX fragment (include)

static <A> Map<A> consequentsMap(Collection<A> c) {
  ret consequentsMap(new Map, c);
}

static <A> Map<A> consequentsMap(Map<A> map, Iterable<A> c) {
  A last = null;
  for (A a : unnull(c)) {
    if (a == null) continue;
    if (last != null)
      map.put(last, a);
    last = a;
  }
  ret map;
}

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: #1014123
Snippet name: consequentsMap - automatically ignores nulls
Eternal ID of this version: #1014123/5
Text MD5: 48b42e259dda68bc7666cbf095b5452a
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-04-11 04:43:21
Source code size: 314 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 326 / 361
Version history: 4 change(s)
Referenced in: [show references]