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

21
LINES

< > BotCompany Repo | #1030253 // lazyMap_bitSet - version of lazyMap usually consuming less space

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

Libraryless. Click here for Pure Java version (2560L/16K).

1  
static <A, B> L<B> lambdaMapLike lazyMap_bitSet(IF1<A, B> f, L<A> l) {
2  
  ret lazyMap_bitSet((O) f, l);
3  
}
4  
5  
static L lazyMap_bitSet(fO f, fL l) {
6  
  ret new RandomAccessAbstractList {
7  
    final int size = l(l);
8  
    new BitSet bitSet;
9  
    new L data;
10  
    
11  
    public int size() { ret size; }
12  
    public O get(int i) {
13  
      if (bitSet.get(i))
14  
        ret data.get(i);
15  
      bitSet.set(i);
16  
      O o = callF(f, l.get(i));
17  
      listPut(data, i, o);
18  
      ret o;
19  
    }
20  
  };
21  
}

Author comment

Began life as a copy of #1018394

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt

No comments. add comment

Snippet ID: #1030253
Snippet name: lazyMap_bitSet - version of lazyMap usually consuming less space
Eternal ID of this version: #1030253/2
Text MD5: bb6511c717f0e20ab617253122ba0105
Transpilation MD5: b4808f2613db823f3541955acdbfe26f
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-11-20 17:08:26
Source code size: 489 bytes / 21 lines
Pitched / IR pitched: No / No
Views / Downloads: 202 / 294
Version history: 1 change(s)
Referenced in: [show references]