1 | static <A> L<A> intersperse(A a, Iterable<A> l) {
|
2 | new L<A> out; |
3 | fOr (A x : l) {
|
4 | if (!empty(out)) out.add(a); |
5 | out.add(x); |
6 | } |
7 | ret out; |
8 | } |
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: | #1025665 |
| Snippet name: | intersperse - add an element between each two elements |
| Eternal ID of this version: | #1025665/1 |
| Text MD5: | 05677b57a56b586458a225f38ef9bdb4 |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2019-10-12 18:43:45 |
| Source code size: | 156 bytes / 8 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 442 / 464 |
| Referenced in: | [show references] |