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

8
LINES

< > BotCompany Repo | #1036002 // filterAntiFilterByBitSet - takes a byte array as the bit set

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

Transpiled version (9247L) is out of date.

1  
static <A> Pair<L<A>> filterAntiFilterByBitSet(L<A> list, byte[] bitSet) {
2  
  int n = l(list), nSet = bitCount(bitSet);
3  
  L<A> l1 = emptyList(nSet);
4  
  L<A> l2 = emptyList(n-nSet);
5  
  for i to n:
6  
    (getBit(bitSet, i) ? l1 : l2).add(list.get(i));
7  
  ret pair(l1, l2);
8  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 2 computer(s): elmgxqgtpvxh, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1036002
Snippet name: filterAntiFilterByBitSet - takes a byte array as the bit set
Eternal ID of this version: #1036002/3
Text MD5: f3166430121a345680f0e39e0c7b6e32
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-08-23 15:07:34
Source code size: 273 bytes / 8 lines
Pitched / IR pitched: No / No
Views / Downloads: 66 / 87
Version history: 2 change(s)
Referenced in: [show references]