Libraryless. Click here for Pure Java version (9180L/51K).
static <A, B> void changeKeyAndModifyValue(Map<A, B> map, A oldKey, A newKey, IF1<B> f) { if (map == null || eq(oldKey, newKey) || !map.containsKey(oldKey)) ret; B value = map.get(oldKey); map.put(newKey, f.get(value)); map.remove(oldKey); }
Began life as a copy of #1026311
download show line numbers debug dex old transpilations
Travelled to 2 computer(s): elmgxqgtpvxh, mqqgnosmbjvj
No comments. add comment
| Snippet ID: | #1035959 |
| Snippet name: | changeKeyAndModifyValue - change key in map, in place, modify the value correspding to key using a function |
| Eternal ID of this version: | #1035959/1 |
| Text MD5: | 4c402c38ac7144db9864db68ef738f29 |
| Transpilation MD5: | 412d61ae52231a62f33ceafa6fb5fd06 |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2022-08-20 16:09:57 |
| Source code size: | 254 bytes / 6 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 336 / 426 |
| Referenced in: | [show references] |