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).

static <A> LPair<A> overlappingPairs_cyclic(L<A> l) {
  new L<Pair<A>> out;
  Iterator<A> it = iterator(l);
  if (!it.hasNext()) ret out;
  A a = it.next(), first = a;
  while (it.hasNext()) {
    A b = it.next();
    addPair(out, a, b);
    a = b;
  }
  addPair(out, a, first);
  ret out;
}

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: 112 / 162
Referenced in: [show references]