Libraryless. Click here for Pure Java version (2173L/14K).
1 | static <A> Set<A> predicateToSet(IPred<A> p) {
|
2 | ret p == null ? null : new AbstractSet<A> {
|
3 | public Iterator<A> iterator() { throw unimplemented(); }
|
4 | public int size() { ret -1; }
|
5 | @Override |
6 | public bool contains(O o) { ret p.get((A) o); }
|
7 | }; |
8 | } |
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
| Snippet ID: | #1027088 |
| Snippet name: | predicateToSet - make a pseudo-set only implementing contains() |
| Eternal ID of this version: | #1027088/3 |
| Text MD5: | da2cc31e9b9078fec904ce306fc09f9c |
| Transpilation MD5: | e8922732258f98028014a7eda87802ca |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2020-02-17 14:47:34 |
| Source code size: | 267 bytes / 8 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 436 / 578 |
| Version history: | 2 change(s) |
| Referenced in: | [show references] |