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

11
LINES

< > BotCompany Repo | #1004133 // renameKeys

JavaX fragment (include)

static Map renameKeys(Map map, O... renames) {
  Map m2 = cloneMap(map);
  for (int i = 0; i+1 < l(renames); i += 2) {
    O o = map.get(renames[i]);
    if (o != null) {
      m2.remove(renames[i]);
      m2.put(renames[i+1], o);
    }
  }
  ret m2;
}

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: 557 / 524
Referenced in: [show references]