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).

1  
static <A> L<A> lazyReversed(L<A> l) {
2  
  ret new RandomAccessAbstractList<A> {
3  
    final int size = l(l);
4  
5  
    public int size() { ret l.size(); }
6  
    
7  
    public A get(int i) {
8  
      ret l.get(size()-1-i);
9  
    }
10  
    
11  
    public A set(int i, A a) {
12  
      ret l.set(size()-1-i, a);
13  
    }
14  
  };
15  
}

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: 247 / 352
Version history: 3 change(s)
Referenced in: [show references]