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

10
LINES

< > BotCompany Repo | #1013476 // detectListInsertion

JavaX fragment (include)

// a = old list, b = new list
static IntRange detectListInsertion(L a, L b) {
  int la = l(a), lb = l(b);
  if (la > lb) null;
  int i = 0;
  while (i < la && eq(a.get(i), b.get(i))) ++i;
  int j = i+lb-la;
  if (!subListsEqual(a, i, b, j, la-i)) null;
  ret intRange(i, j);
}

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: #1013476
Snippet name: detectListInsertion
Eternal ID of this version: #1013476/1
Text MD5: 7e9e18b6c7733d10af17134a43e112d8
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-01-07 14:04:48
Source code size: 285 bytes / 10 lines
Pitched / IR pitched: No / No
Views / Downloads: 420 / 468
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)