1 | static <A> bool containsAny(Collection<A> a, Collection<A> b) { |
2 | if (empty(a) || empty(b)) false; |
3 | Set<A> set = asSet(b); |
4 | for (A x : a) |
5 | if (contains(set, x)) |
6 | true; |
7 | false; |
8 | } |
9 | |
10 | // iterates over b |
11 | static <A, B> bool containsAny(Map<A, B> a, Collection<A> b) { |
12 | if (empty(a)) false; |
13 | if (b != null) for (A x : b) |
14 | if (a.containsKey(x)) |
15 | true; |
16 | false; |
17 | } |
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1021454 |
Snippet name: | containsAny |
Eternal ID of this version: | #1021454/11 |
Text MD5: | d47e78bbf22f1059d3881fff4b82445c |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-03-03 12:04:41 |
Source code size: | 390 bytes / 17 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 359 / 382 |
Version history: | 10 change(s) |
Referenced in: | [show references] |