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

10
LINES

< > BotCompany Repo | #1013476 // detectListInsertion

JavaX fragment (include)

1  
// a = old list, b = new list
2  
static IntRange detectListInsertion(L a, L b) {
3  
  int la = l(a), lb = l(b);
4  
  if (la > lb) null;
5  
  int i = 0;
6  
  while (i < la && eq(a.get(i), b.get(i))) ++i;
7  
  int j = i+lb-la;
8  
  if (!subListsEqual(a, i, b, j, la-i)) null;
9  
  ret intRange(i, j);
10  
}

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