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

15
LINES

< > BotCompany Repo | #1026817 // lazyReversed - virtual reversed list

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

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

static <A> L<A> lazyReversed(L<A> l) {
  ret new RandomAccessAbstractList<A> {
    final int size = l(l);

    public int size() { ret l.size(); }
    
    public A get(int i) {
      ret l.get(size()-1-i);
    }
    
    public A set(int i, A a) {
      ret l.set(size()-1-i, a);
    }
  };
}

Author comment

Began life as a copy of #1013064

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: #1026817
Snippet name: lazyReversed - virtual reversed list
Eternal ID of this version: #1026817/4
Text MD5: ca478264275b6868c10083b0b545f7fc
Transpilation MD5: cf5925a3cac24efc366f3f4519c8dac3
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-01-23 20:54:51
Source code size: 307 bytes / 15 lines
Pitched / IR pitched: No / No
Views / Downloads: 246 / 349
Version history: 3 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)