Libraryless. Click here for Pure Java version (4192L/24K).
1 | /*static <A> L<A> printNumberedLines(L<A> l) { |
2 | printNumberedLines((Collection<A>) l); |
3 | ret l; |
4 | } |
5 | |
6 | static <A> L<A> printNumberedLines(S prefix, L<A> l) { |
7 | printNumberedLines(prefix, (Collection<A>) l); |
8 | ret l; |
9 | }*/ |
10 | |
11 | svoid printNumberedLines(Map map) { |
12 | printNumberedLines(mapToLines(map)); |
13 | } |
14 | |
15 | svoid printNumberedLines(S prefix, Map map) { |
16 | printNumberedLines(prefix, mapToLines(map)); |
17 | } |
18 | |
19 | static <A extends Iterable> A printNumberedLines(A l) { |
20 | int i = 0; |
21 | if (l != null) for (O a : cloneList(l)) print((++i) + ". " + str(a)); |
22 | ret l; |
23 | } |
24 | |
25 | static <A extends Iterable> A printNumberedLines(S prefix, A l) { |
26 | int i = 0; |
27 | if (l != null) for (O a : cloneList(l)) print(prefix + (++i) + ". " + str(a)); |
28 | ret l; |
29 | } |
30 | |
31 | static void printNumberedLines(S prefix default "", O[] l) { |
32 | printNumberedLines(prefix, wrapAsList(l)); |
33 | } |
34 | |
35 | static void printNumberedLines(O o) { |
36 | printNumberedLines(lines(str(o))); |
37 | } |
download show line numbers debug dex old transpilations
Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, whxojlpjdney, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1007684 |
Snippet name: | printNumberedLines - now clones the list first |
Eternal ID of this version: | #1007684/18 |
Text MD5: | e690ff3b4719640da93bc0960949a73c |
Transpilation MD5: | bb85af7d45751cbc05c5b55a9a89ce39 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-10-06 04:08:51 |
Source code size: | 938 bytes / 37 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 792 / 853 |
Version history: | 17 change(s) |
Referenced in: | [show references] |