Libraryless. Click here for Pure Java version (2310L/14K).
1 | static <A> IterableIterator<A> filterIterator(final Iterator<A> it, final F1<A, Bool> f) { |
2 | if (it == null) null; |
3 | ret iff(func -> O { |
4 | while (it.hasNext()) { |
5 | A a = it.next(); |
6 | if (callF(f, a)) |
7 | ret a; |
8 | } |
9 | ret endMarker(); |
10 | }); |
11 | } |
12 | |
13 | static <A> IterableIterator<A> filterIterator(final Iterator<A> it, final IF1<A, Bool> f) { |
14 | if (it == null) null; |
15 | ret iff(func -> O { |
16 | while (it.hasNext()) { |
17 | A a = it.next(); |
18 | if (callF(f, a)) |
19 | ret a; |
20 | } |
21 | ret endMarker(); |
22 | }); |
23 | } |
24 | |
25 | static <A> IterableIterator<A> filterIterator(final F1<A, Bool> f, final Iterator<A> it) { |
26 | ret filterIterator(it, f); |
27 | } |
28 | |
29 | static <A> IterableIterator<A> filterIterator(Cl<A> l, IF1<A, Bool> f) { |
30 | if (l == null) null; |
31 | Iterator<A> it = iterator(l); |
32 | ret iff(func -> O { |
33 | while (it.hasNext()) { |
34 | A a = it.next(); |
35 | if (f.get(a)) |
36 | ret a; |
37 | } |
38 | ret endMarker(); |
39 | }); |
40 | } |
41 | |
42 | static <A> ItIt<A> lambdaMapLike filterIterator(IF1<A, Bool> f, Iterator<A> it) { |
43 | ret filterIterator(it, f); |
44 | } |
Began life as a copy of #1014420
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1015351 |
Snippet name: | filterIterator |
Eternal ID of this version: | #1015351/9 |
Text MD5: | d1740ae292707c9c0ca4cde746d46fe0 |
Transpilation MD5: | a6331d2d8092587fad91ff5f2c655b80 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-01-16 18:57:09 |
Source code size: | 1072 bytes / 44 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 415 / 544 |
Version history: | 8 change(s) |
Referenced in: | [show references] |