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

13
LINES

< > BotCompany Repo | #1030566 // overlappingPairs_cyclic - plus last pair (last element, first element)

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (116L/1K).

1  
static <A> LPair<A> overlappingPairs_cyclic(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(), first = a;
6  
  while (it.hasNext()) {
7  
    A b = it.next();
8  
    addPair(out, a, b);
9  
    a = b;
10  
  }
11  
  addPair(out, a, first);
12  
  ret out;
13  
}

Author comment

Began life as a copy of #1022446

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt

No comments. add comment

Snippet ID: #1030566
Snippet name: overlappingPairs_cyclic - plus last pair (last element, first element)
Eternal ID of this version: #1030566/1
Text MD5: 5ee0a82d4efbaffe587bbe9b04a04893
Transpilation MD5: b69cfcb045443512733a71f7b9f940aa
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-01-07 19:42:24
Source code size: 303 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 204 / 278
Referenced in: [show references]