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   

Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pzhvpgtvlbxg, tvejysmllsmz

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: 24 / 40
Version history: 1 change(s)
Referenced in: [show references]

Formerly at http://tinybrain.de/1026311 & http://1026311.tinybrain.de