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

15
LINES

< > BotCompany Repo | #1028570 // ListAndIndex

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

Transpiled version (4621L) is out of date.

srecord ListAndIndex<A>(L<A> list, int idx) {
  bool atEnd() { ret idx >= l(list); }
  
  A get() { ret _get(list, idx); }
  int size() { ret l(list); }
  
  toString {
    ret subList(list, 0, idx) + ", then " + subList(list, idx);
  }
  
  ListAndIndex<A> plus(int ofs) { ret ListAndIndex(list, idx+ofs); }
  
  L<A> list() { ret list; }
  int index aka idx() { ret idx; }
}

download  show line numbers  debug dex  old transpilations   

Travelled to 8 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1028570
Snippet name: ListAndIndex
Eternal ID of this version: #1028570/10
Text MD5: 5943e5f1e4e72bb02d34cb3abd799969
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-01-15 20:13:23
Source code size: 390 bytes / 15 lines
Pitched / IR pitched: No / No
Views / Downloads: 146 / 454
Version history: 9 change(s)
Referenced in: [show references]