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

11
LINES

< > BotCompany Repo | #1008062 // keysWithValue - reverse map lookup

JavaX fragment (include)

static <A, B> L<A> keysWithValue(Map<A, B> map, B value) {
  new L<A> l;
  for (A key : keys(map))
    if (eq(map.get(key), value))
      l.add(key);
  ret l;
}

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

Author comment

Began life as a copy of #1006680

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: #1008062
Snippet name: keysWithValue - reverse map lookup
Eternal ID of this version: #1008062/3
Text MD5: 455d4eaebfc04ec8c1eaabc656b8f757
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-04-21 13:42:20
Source code size: 265 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 438 / 472
Version history: 2 change(s)
Referenced in: [show references]