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

10
LINES

< > BotCompany Repo | #1030224 - getAndRemove - get element from map and remove

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

Transpiled version (36L) is out of date.

static <A, B> B getAndRemove(Map<A, B> map, A a) {
  if (!containsKey(map, a)) null;
  B b = map.get(a);
  map.remove(a);
  ret b;
}

static <A, B> B getAndRemove(A a, Map<A, B> map) {
  ret getAndRemove(map, a);
}

Author comment

Began life as a copy of #1008055

download  show line numbers  debug dex   

Travelled to 3 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx

No comments. add comment

Snippet ID: #1030224
Snippet name: getAndRemove - get element from map and remove
Eternal ID of this version: #1030224/2
Text MD5: ebc00806f9c9a30cc9aaf9a6ec53eef6
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-11-17 14:59:07
Source code size: 219 bytes / 10 lines
Pitched / IR pitched: No / No
Views / Downloads: 20 / 37
Version history: 1 change(s)
Referenced in: [show references]

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