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

10
LINES

< > TinyBrain | #1001831 - Test magicIndexOfSubList (OK)

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Libraryless. Click here for Pure Java version (1164L/8K/29K).

!7

p {
  L<S> list = litlist("a", "b", "a", "b");
  L<S> sublist = list.subList(2, 4);
  
  // Note that we couldn't find this out without the magic trick
  // (comparison by elements would yield 0 instead of 2).
  print("Index (should be 2): " + magicIndexOfSubList(list, sublist));
}

download  show line numbers  debug dex   

Travelled to 11 computer(s): aoiabmzegqzx, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, teubizvjbppd, tslmcundralx, tvejysmllsmz

Comments [hide]

ID Author/Program Comment Date
1179 stefan Works! 2015-11-21 19:00:28

add comment

Snippet ID: #1001831
Snippet name: Test magicIndexOfSubList (OK)
Eternal ID of this version: #1001831/3
Text MD5: 6f3c52e1a69026b12b4e1ef16aa29033
Transpilation MD5: de0bdb4aa2303dabf8abc52486a2f764
Author: stefan
Category:
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-09-11 17:16:05
Source code size: 295 bytes / 10 lines
Pitched / IR pitched: No / No
Views / Downloads: 336 / 300
Version history: 2 change(s)
Referenced in: [show]