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: 529 / 561
Version history: 2 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1011163 - keysWithValueTrue - keys where map value = true
#1015773 - keysWithValueContainingSubstring
#1023716 - firstKeyWithValue - reverse map lookup
#1028090 - countKeysWithValue
#1028141 - keysWithValueThat - filter on value predicate