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

5
LINES

< > BotCompany Repo | #1005778 // getOrKeep - get from map or keep key if not in map

JavaX fragment (include)

static <A> A getOrKeep(Map<A, ? extends A> map, A a) {
  if (map == null) ret a;
  A v = map.get(a);
  ret v != null ? v : a;
}

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, sawdedvomwva, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1005778
Snippet name: getOrKeep - get from map or keep key if not in map
Eternal ID of this version: #1005778/2
Text MD5: 7e0efb98ec201093f0ef99749dd9ddc1
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-03-02 14:12:25
Source code size: 131 bytes / 5 lines
Pitched / IR pitched: No / No
Views / Downloads: 474 / 513
Version history: 1 change(s)
Referenced in: [show references]