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)

1  
static <A> Map<A> consequentsMap(Collection<A> c) {
2  
  ret consequentsMap(new Map, c);
3  
}
4  
5  
static <A> Map<A> consequentsMap(Map<A> map, Iterable<A> c) {
6  
  A last = null;
7  
  for (A a : unnull(c)) {
8  
    if (a == null) continue;
9  
    if (last != null)
10  
      map.put(last, a);
11  
    last = a;
12  
  }
13  
  ret map;
14  
}

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: 418 / 447
Version history: 4 change(s)
Referenced in: [show references]