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

6
LINES

< > BotCompany Repo | #1004291 // mergeMappings - merge two maps if no conflicts

JavaX fragment (include)

1  
static <A, B> Map<A, B> mergeMappings(Map<A, B> a, Map<A, B> b) {
2  
  for (A var : keys(a))
3  
    if (b.containsKey(var) && neq(a.get(var), b.get(var)))
4  
      null; // fail
5  
  ret mergeMaps(a, b);
6  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1004291
Snippet name: mergeMappings - merge two maps if no conflicts
Eternal ID of this version: #1004291/1
Text MD5: 16a9309372741e7414c726d39a6ed477
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-08-12 19:06:03
Source code size: 200 bytes / 6 lines
Pitched / IR pitched: No / No
Views / Downloads: 636 / 588
Referenced in: [show references]