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

5
LINES

< > BotCompany Repo | #1026311 // changeKey - change key in map, in place

JavaX fragment (include)

svoid changeKey(Map map, O oldKey, O newKey) {
  if (map == null || eq(oldKey, newKey) || !map.containsKey(oldKey)) ret;
  map.put(newKey, map.get(oldKey));
  map.remove(oldKey);
}

Author comment

Began life as a copy of #1004133

download  show line numbers  debug dex  old transpilations   

Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1026311
Snippet name: changeKey - change key in map, in place
Eternal ID of this version: #1026311/2
Text MD5: 1bb5fb36490a8dc9f45d2afa451731b5
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-12-15 19:11:23
Source code size: 184 bytes / 5 lines
Pitched / IR pitched: No / No
Views / Downloads: 269 / 322
Version history: 1 change(s)
Referenced in: [show references]