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

6
LINES

< > BotCompany Repo | #1018576 // zipTwoListsToMap - uses length of shorter one

JavaX fragment (include)

1  
static <A, B> Map<A, B> zipTwoListsToMap(L<A> l1, L<B> l2) {
2  
  int n = min(l(l1), l(l2));
3  
  new HashMap<A, B> map;
4  
  for i to n: map.put(l1.get(i), l2.get(i));
5  
  ret map;
6  
}

Author comment

Began life as a copy of #1017453

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1018576
Snippet name: zipTwoListsToMap - uses length of shorter one
Eternal ID of this version: #1018576/1
Text MD5: d0d19c5fae41cf28b58deb80d2f02401
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-10-06 16:02:01
Source code size: 177 bytes / 6 lines
Pitched / IR pitched: No / No
Views / Downloads: 372 / 407
Referenced in: [show references]