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

7
LINES

< > BotCompany Repo | #1027656 // mapWithIndexStartingAt1

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

Libraryless. Click here for Pure Java version (2729L/16K).

static <A, B> L<B> mapWithIndexStartingAt1(Cl<A> l, IF2<Int, A, B> f) {
  int n = l(l), i = 0;
  L<B> out = emptyList(n);
  fOr (A a : l)
    out.add(f.get(++i, a));
  ret out;
}

Author comment

Began life as a copy of #1027129

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1027656
Snippet name: mapWithIndexStartingAt1
Eternal ID of this version: #1027656/4
Text MD5: 9ccad221443580d0e7aeff4253adfb06
Transpilation MD5: f0249b8cae303a5f5f24cf0dae0a335b
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-05-13 18:22:43
Source code size: 184 bytes / 7 lines
Pitched / IR pitched: No / No
Views / Downloads: 184 / 277
Version history: 3 change(s)
Referenced in: [show references]