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

22
LINES

< > BotCompany Repo | #1024711 // filterListByPredicateOnIndex

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

Libraryless. Click here for Pure Java version (9184L/51K).

1  
// old syntax
2  
static <A> L<A> filterListByPredicateOnIndex(O pred, L<A> l) {
3  
  new L<A> out;
4  
  int n = l(l);
5  
  for i to n:
6  
    if (isTrue_callF(pred, i))
7  
      out.add(l.get(i));
8  
  ret out;
9  
}
10  
11  
static <A> L<A> lambdaMapLike filterListByPredicateOnIndex(IIntPred pred, L<A> l) {
12  
  new L<A> out;
13  
  int n = l(l);
14  
  for i to n:
15  
    if (pred.get(i))
16  
      out.add(l.get(i));
17  
  ret out;
18  
}
19  
20  
static <A> L<A> filterListByPredicateOnIndex(L<A> l, IIntPred pred) {
21  
  ret filterListByPredicateOnIndex(pred, l);
22  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1024711
Snippet name: filterListByPredicateOnIndex
Eternal ID of this version: #1024711/4
Text MD5: 1f16180f92695ff0d273e9524842da75
Transpilation MD5: 149065f0358f6b50e4911e3c88eac2d2
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-08-05 18:36:52
Source code size: 522 bytes / 22 lines
Pitched / IR pitched: No / No
Views / Downloads: 199 / 292
Version history: 3 change(s)
Referenced in: [show references]