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

10
LINES

< > BotCompany Repo | #1002303 // reverseLookup - look up a key from a value

JavaX fragment (include)

static <A, B> A reverseLookup(B value, Map<A, B> map) {
  ret reverseLookup(map, value);
}

static <A, B> A reverseLookup(Map<A, B> map, B value) {
  if (map != null && value != null) for (A key : map.keySet())
    if (eq(map.get(key), value))
      ret key;
  ret null;
}

Author comment

Began life as a copy of #1002107

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1002303
Snippet name: reverseLookup - look up a key from a value
Eternal ID of this version: #1002303/5
Text MD5: bf455c346d01bd2ef79bccf8c2e7ac37
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-04-20 12:58:29
Source code size: 281 bytes / 10 lines
Pitched / IR pitched: No / No
Views / Downloads: 757 / 1138
Version history: 4 change(s)
Referenced in: [show references]