static <A> Collection<A> combinedCollection(final Collection<A> a, final Collection<A> b) { if (empty(a)) ret b; if (empty(b)) ret a; ret new AbstractCollection<A> { public int size() { ret a.size() + b.size(); } // >= real value public bool contains(O o) { ret a.contains(o) || b.contains(o); } public Iterator<A> iterator() { fail("not implemented"); } }; }
download show line numbers debug dex old transpilations
Travelled to 8 computer(s): bhatertpkbcr, cfunsshuasjs, gwrvuhgaqvyk, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1020676 |
| Snippet name: | combinedCollection - contains()-only combined collection |
| Eternal ID of this version: | #1020676/2 |
| Text MD5: | d9b057181196bd7522dd295185956cb9 |
| Author: | stefan |
| Category: | javax / a.i. |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2018-12-30 18:34:45 |
| Source code size: | 391 bytes / 10 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 503 / 551 |
| Version history: | 1 change(s) |
| Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) |