Libraryless. Click here for Pure Java version (2798L/16K).
// unclear semantics when l is a special set (e.g. ciSet) static <A> bool containsOneOf(Collection<A> l, A... x) { if (l instanceof Set) { if (x != null) for (A a : x) if (l.contains(a)) true; } else { for (A a : unnull(l)) if (eqOneOf(a, x)) true; } false; } static <A> bool containsOneOf(Collection<A> l, Set<A> set) { if (set == null) false; for (A a : unnull(l)) if (set.contains(a)) true; false; } static bool containsOneOf(S s, S... x) { for (S o : x) if (contains(s, o)) true; false; }
download show line numbers debug dex old transpilations
Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1003859 |
| Snippet name: | containsOneOf - possibly slow with array as 2nd argument; fast with Set |
| Eternal ID of this version: | #1003859/9 |
| Text MD5: | 84965dbb1088def45e1c19dfd54bc25d |
| Transpilation MD5: | cfb00185f39a27c6b5f305361fcf7644 |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2021-06-05 00:50:26 |
| Source code size: | 601 bytes / 29 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 1278 / 1445 |
| Version history: | 8 change(s) |
| Referenced in: | [show references] |