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

13
LINES

< > BotCompany Repo | #1030287 // subListEquals

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

Libraryless. Click here for Pure Java version (2537L/16K).

sbool <A> subListEquals(L<A> l, L<A> pat, int i) {
  if (i < 0) false;
  int j = i+l(pat);
  if (j > l(l)) false;
  for (int k = i; k < j; k++)
    if (!eq(l.get(k), pat.get(k-i)))
      false;
  true;
}

sbool <A> subListEquals(L<A> l, int i, A... pat) {
  ret subListEquals(l, asVirtualList(pat), i);
}

Author comment

Began life as a copy of #1022225

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1030287
Snippet name: subListEquals
Eternal ID of this version: #1030287/3
Text MD5: e33e7979b7b82206fedbd3aead262b28
Transpilation MD5: 89cc0c817c5e12b623aa6146944f253e
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-11-27 15:16:57
Source code size: 316 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 203 / 298
Version history: 2 change(s)
Referenced in: [show references]