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

12
LINES

< > BotCompany Repo | #1010324 // twoListsToHashMap

JavaX fragment (include)

static <A> HashMap<A> twoListsToHashMap(L<A> l1, L<A> l2) {
  if (l(l1) != l(l2)) fail("Differing list size: " + l(l1) + "/" + l(l2));
  new HashMap<A> map;
  int n = l(l1);
  for i to n:
    map.put(l1.get(i), l2.get(i));
  ret map;
}

static <A> HashMap<A> twoListsToHashMap(A[] l1, A[] l2) {
  ret twoListsToHashMap(Arrays.asList(l1), Arrays.asList(l2));
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1010324
Snippet name: twoListsToHashMap
Eternal ID of this version: #1010324/3
Text MD5: cda98a83ef3f64a391c2d56a88891153
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-10-05 00:38:40
Source code size: 370 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 413 / 453
Version history: 2 change(s)
Referenced in: [show references]