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

9
LINES

< > BotCompany Repo | #1030196 // onlyKeys

JavaX fragment (include)

1  
// TODO: work the other way around when set is small
2  
static <A, B> Map<A, B> onlyKeys(Map<A, B> map, Cl<A> keys) {
3  
  Set<A> keySet = asSet(keys);
4  
  ret filterKeys(map, a -> contains(keySet, a));
5  
}
6  
7  
static <A, B> Map<A, B> onlyKeys(Map<A, B> map, A... keys) {
8  
  ret onlyKeys(map, litset(keys));
9  
}

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: 124 / 158
Version history: 1 change(s)
Referenced in: [show references]