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)

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

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: 373 / 407
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1021256 - zipTwoListsToCIMap_strict - only if length matches and there are no map overwrites
#1028744 - zipTwoListsToOrderedMap - uses length of shorter one