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

13
LINES

< > BotCompany Repo | #1022446 // overlappingPairsPlus1 - plus last pair (last element, null)

JavaX fragment (include)

1  
static <A> LPair<A> overlappingPairsPlus1(L<A> l) {
2  
  new L<Pair<A>> out;
3  
  Iterator<A> it = iterator(l);
4  
  if (!it.hasNext()) ret out;
5  
  A a = it.next();
6  
  while (it.hasNext()) {
7  
    A b = it.next();
8  
    addPair(out, a, b);
9  
    a = b;
10  
  }
11  
  addPair(out, a, null);
12  
  ret out;
13  
}

Author comment

Began life as a copy of #1014575

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1022446
Snippet name: overlappingPairsPlus1 - plus last pair (last element, null)
Eternal ID of this version: #1022446/1
Text MD5: 070f074287a6e818e89ab5cf4e7cbc4e
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-03-17 14:06:43
Source code size: 289 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 304 / 332
Referenced in: [show references]