1 | static L map_printProgress(Collection l, O f) {
|
2 | ret map_printProgress(f, l); |
3 | } |
4 | |
5 | static L map_printProgress(O f, Collection l) {
|
6 | L x = emptyList(l); |
7 | if (nempty(l)) {
|
8 | int i = 0, n = l(l); |
9 | S desc = null; |
10 | NotTooOften nto = onlyEverySecond(); |
11 | nto.yo(); // wait 1 second before printing |
12 | bool printed = false; |
13 | for (O o : l) {
|
14 | x.add(callF(f, o)); |
15 | ++i; |
16 | if (nto.yo()) {
|
17 | printed = true; |
18 | if (desc == null) desc = shorten(str(f), 20); |
19 | print(desc + ": " + i + "/" + n); |
20 | } |
21 | } |
22 | if (printed) |
23 | print(desc + ": " + n + " done"); |
24 | } |
25 | ret x; |
26 | } |
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1018773 |
| Snippet name: | map_printProgress - map + print progress on console |
| Eternal ID of this version: | #1018773/5 |
| Text MD5: | 6614e1d705e5ee9afb753157b9ee7b24 |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2018-10-13 16:07:59 |
| Source code size: | 638 bytes / 26 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 577 / 608 |
| Version history: | 4 change(s) |
| Referenced in: | [show references] |