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

5
LINES

< > BotCompany Repo | #1010874 // dropValuesFromMapOtherThan - modifies original map

JavaX fragment (include)

static <A, B> void dropValuesFromMapOtherThan(Map<A, B> map, B... values) {
  HashSet<B> valueSet = new HashSet(Arrays.asList(values));
  for (Iterator<Map.Entry<A, B>> it = map.entrySet().iterator(); it.hasNext();)
    if (!valueSet.contains(it.next().getValue())) it.remove();
}

Author comment

Began life as a copy of #1010873

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: #1010874
Snippet name: dropValuesFromMapOtherThan - modifies original map
Eternal ID of this version: #1010874/2
Text MD5: 8a9646b9e34176d71c3a20f37669ed25
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-10-05 00:17:30
Source code size: 284 bytes / 5 lines
Pitched / IR pitched: No / No
Views / Downloads: 487 / 499
Version history: 1 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)