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

12
LINES

< > BotCompany Repo | #1029621 // filterByValuePredicate - filter map by value predicate

JavaX fragment (include) [tags: use-pretranspiled]

Transpiled version (2516L) is out of date.

static <A, B> Map<A, B> lambdaMapLike filterByValuePredicate(IPred<B> pred, Map<A, B> map) {
  if (map == null) null;
  Map<A, B> map2 = similarEmptyMap(map);
  for (Map.Entry<A, B> e : map.entrySet())
    if (pred.get(e.getValue()))
      map2.put(e.getKey(), e.getValue());
  ret map2;
}

static <A, B> Map<A, B> filterByValuePredicate(Map<A, B> map, IPred<B> pred) {
  ret filterByValuePredicate(pred, map);
}

Author comment

Began life as a copy of #1028141

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1029621
Snippet name: filterByValuePredicate - filter map by value predicate
Eternal ID of this version: #1029621/4
Text MD5: 978c4ac8ba3fe6bf413b7eb1108686ea
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-11-30 13:49:05
Source code size: 423 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 219 / 333
Version history: 3 change(s)
Referenced in: [show references]