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

9
LINES

< > BotCompany Repo | #1030196 // onlyKeys

JavaX fragment (include)

// TODO: work the other way around when set is small
static <A, B> Map<A, B> onlyKeys(Map<A, B> map, Cl<A> keys) {
  Set<A> keySet = asSet(keys);
  ret filterKeys(map, a -> contains(keySet, a));
}

static <A, B> Map<A, B> onlyKeys(Map<A, B> map, A... keys) {
  ret onlyKeys(map, litset(keys));
}

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt

No comments. add comment

Snippet ID: #1030196
Snippet name: onlyKeys
Eternal ID of this version: #1030196/2
Text MD5: 0101c08bb1bb7c979db85d31b3e8982f
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-11-16 12:16:47
Source code size: 303 bytes / 9 lines
Pitched / IR pitched: No / No
Views / Downloads: 192 / 228
Version history: 1 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)