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

6
LINES

< > BotCompany Repo | #1028744 // zipTwoListsToOrderedMap - uses length of shorter one

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

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

static <A, B> Map<A, B> zipTwoListsToOrderedMap(L<A> l1, L<B> l2) {
  int n = min(l(l1), l(l2));
  new LinkedHashMap<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 #1018576

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: #1028744
Snippet name: zipTwoListsToOrderedMap - uses length of shorter one
Eternal ID of this version: #1028744/1
Text MD5: 8f13a827e4781a572f55065d2bb57744
Transpilation MD5: fe93c1597a9d953ca2381632c8f720c1
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-07-06 21:19:12
Source code size: 190 bytes / 6 lines
Pitched / IR pitched: No / No
Views / Downloads: 196 / 283
Referenced in: [show references]