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)

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

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: 305 / 332
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1030566 - overlappingPairs_cyclic - plus last pair (last element, first element)