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

12
LINES

< > BotCompany Repo | #1011670 // filterMapByFunctionOnKey - filter map by func(A) -> Bool

JavaX fragment (include)

static <A, B> Map<A, B> filterMapByFunctionOnKey(Map<A, B> map, O f) {
  Map<A, B> m2 = similarEmptyMap(map);
  for (A a : keys(map)) {
    if (isTrue(callF(f, a)))
      m2.put(a, map.get(a));
  }
  ret m2;
}

static <A, B> Map<A, B> filterMapByFunctionOnKey(O f, Map<A, B> map) {
  ret filterMapByFunctionOnKey(map, f);
}

Author comment

Began life as a copy of #1009585

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: #1011670
Snippet name: filterMapByFunctionOnKey - filter map by func(A) -> Bool
Eternal ID of this version: #1011670/5
Text MD5: 814d5388d74dd1ed8e46d6dda6f920ab
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-05-13 12:57:41
Source code size: 334 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 406 / 443
Version history: 4 change(s)
Referenced in: [show references]