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

6
LINES

< > BotCompany Repo | #1017453 // zipTwoListsToPairs - uses length of shorter one

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

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

1  
static <A, B> L<Pair<A, B>> zipTwoListsToPairs(L<A> l1, L<B> l2) {
2  
  int n = min(l(l1), l(l2));
3  
  LPair<A, B> out = emptyList(n);
4  
  for i to n: addPair(out, l1.get(i), l2.get(i));
5  
  ret out;
6  
}

Author comment

Began life as a copy of #1017193

download  show line numbers  debug dex  old transpilations   

Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1017453
Snippet name: zipTwoListsToPairs - uses length of shorter one
Eternal ID of this version: #1017453/2
Text MD5: 9031262585335b74a24bd65424f3337b
Transpilation MD5: 1eae13bcf36080498e7a99983a318e6d
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-10-29 14:18:59
Source code size: 197 bytes / 6 lines
Pitched / IR pitched: No / No
Views / Downloads: 418 / 559
Version history: 1 change(s)
Referenced in: [show references]