Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

8
LINES

< > BotCompany Repo | #1036550 // intersperseF - add a function result between each two elements

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (10051L/55K).

1  
static <A> L<A> intersperseF(IF0<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  
}

Author comment

Began life as a copy of #1025665

download  show line numbers  debug dex  old transpilations   

Travelled to 2 computer(s): mqqgnosmbjvj, wnsclhtenguj

No comments. add comment

Snippet ID: #1036550
Snippet name: intersperseF - add a function result between each two elements
Eternal ID of this version: #1036550/1
Text MD5: c4e4056d3e7a34baa807df61c24ba1ba
Transpilation MD5: 82cb32526038ab230e31cd1a9b632428
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2023-02-12 20:03:32
Source code size: 163 bytes / 8 lines
Pitched / IR pitched: No / No
Views / Downloads: 144 / 210
Referenced in: [show references]