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

9
LINES

< > BotCompany Repo | #1027740 // zipTwoListsToMap_strict - only if length matches and there are no map overwrites

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

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

1  
static <A, B> Map<A, B> zipTwoListsToMap_strict(L<A> l1, L<B> l2) {
2  
  int n = l(l1);
3  
  if (n != l(l2)) null;
4  
  new Map map;
5  
  for i to n:
6  
    if (!strictPut(map, l1.get(i), l2.get(i)))
7  
      null;
8  
  ret map;
9  
}

Author comment

Began life as a copy of #1021256

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: #1027740
Snippet name: zipTwoListsToMap_strict - only if length matches and there are no map overwrites
Eternal ID of this version: #1027740/1
Text MD5: a43cb8652937e2493098600635830876
Transpilation MD5: 76d8f964e9be2104e5c2d9bc59ab18b9
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-04-09 22:21:24
Source code size: 217 bytes / 9 lines
Pitched / IR pitched: No / No
Views / Downloads: 194 / 289
Referenced in: [show references]