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

6
LINES

< > BotCompany Repo | #1031153 // removeAndPut - first remove key, then put it into map again [for MRUCache]

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (31L/1K).

static <A, B> void removeAndPut(Map<A, B> map, A key, B value) {
  if (map != null) {
    map.remove(key);
    map.put(key, value);
  }
}

Author comment

Began life as a copy of #1007227

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt

No comments. add comment

Snippet ID: #1031153
Snippet name: removeAndPut - first remove key, then put it into map again [for MRUCache]
Eternal ID of this version: #1031153/1
Text MD5: 05a9dc8d384d103c0e7a79696d43cd59
Transpilation MD5: e510899f7cbe23541db58af63ce5a319
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-05-13 18:29:26
Source code size: 142 bytes / 6 lines
Pitched / IR pitched: No / No
Views / Downloads: 168 / 218
Referenced in: [show references]