Libraryless. Click here for Pure Java version (1748L/11K).
1 | static <A> int nfilter(Iterable<A> c, IF1<A, Bool> pred) { |
2 | ret nfilter(pred, c); |
3 | } |
4 | |
5 | static <A> int nfilter(IF1<A, Bool> pred, Iterable<A> c) { |
6 | int n = 0; |
7 | if (c != null) for (A o : c) |
8 | if (pred.get(o)) |
9 | ++n; |
10 | ret n; |
11 | } |
12 | |
13 | static int nfilter(Iterable c, O pred) { |
14 | int n = 0; |
15 | if (c != null) for (O o : c) |
16 | if (isTrue(callF(pred, o))) |
17 | ++n; |
18 | ret n; |
19 | } |
20 | |
21 | static int nfilter(O pred, Iterable c) { |
22 | ret nfilter(c, pred); |
23 | } |
Began life as a copy of #1003524
download show line numbers debug dex old transpilations
Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, podlckwnjdmb, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1004349 |
Snippet name: | nfilter - count objects in collection that match a predicate |
Eternal ID of this version: | #1004349/5 |
Text MD5: | b42fee7ad9490d3ff27836c3d162b64c |
Transpilation MD5: | 386ed1eea0ed398b584334bcbd3c4786 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-08-13 09:25:29 |
Source code size: | 463 bytes / 23 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 718 / 720 |
Version history: | 4 change(s) |
Referenced in: | [show references] |