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

9
LINES

< > BotCompany Repo | #1026420 // listEntryWithPrevAndNext

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

Libraryless. Click here for Pure Java version (2235L/14K).

static <A> ListEntryWithPrevAndNext<A> listEntryWithPrevAndNext(L<A> l, int idx) {
  if (idx < 0 || idx >= l(l)) null;
  ret new ListEntryWithPrevAndNext<A>() {
    public A get() { ret _get(l, idx); }
    public void set(A a) { l.set(idx, a); }
    public ListEntryWithPrevAndNext<A> prev() { ret listEntryWithPrevAndNext(l, idx-1); }
    public ListEntryWithPrevAndNext<A> next() { ret listEntryWithPrevAndNext(l, idx+1); }
  };
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1026420
Snippet name: listEntryWithPrevAndNext
Eternal ID of this version: #1026420/8
Text MD5: b73cc15785c6de7243211a966669e624
Transpilation MD5: 357bf190f194aa3c3e8a7108a671faeb
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-01-03 16:58:56
Source code size: 442 bytes / 9 lines
Pitched / IR pitched: No / No
Views / Downloads: 119 / 202
Version history: 7 change(s)
Referenced in: [show references]