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

11
LINES

< > BotCompany Repo | #1004133 // renameKeys

JavaX fragment (include)

1  
static Map renameKeys(Map map, O... renames) {
2  
  Map m2 = cloneMap(map);
3  
  for (int i = 0; i+1 < l(renames); i += 2) {
4  
    O o = map.get(renames[i]);
5  
    if (o != null) {
6  
      m2.remove(renames[i]);
7  
      m2.put(renames[i+1], o);
8  
    }
9  
  }
10  
  ret m2;
11  
}

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: #1004133
Snippet name: renameKeys
Eternal ID of this version: #1004133/1
Text MD5: 5f6b364050cd7a5cbd962a194d05eb06
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-08-07 23:48:45
Source code size: 262 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 499 / 462
Referenced in: [show references]