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

static <A, B> L<B> lambdaMapLike lazyMap_bitSet(IF1<A, B> f, L<A> l) {
  ret lazyMap_bitSet((O) f, l);
}

static L lazyMap_bitSet(fO f, fL l) {
  ret new RandomAccessAbstractList {
    final int size = l(l);
    new BitSet bitSet;
    new L data;
    
    public int size() { ret size; }
    public O get(int i) {
      if (bitSet.get(i))
        ret data.get(i);
      bitSet.set(i);
      O o = callF(f, l.get(i));
      listPut(data, i, o);
      ret o;
    }
  };
}

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: 91 / 143
Version history: 1 change(s)
Referenced in: [show references]