Libraryless. Click here for Pure Java version (2173L/14K).
static <A> Set<A> predicateToSet(IPred<A> p) { ret p == null ? null : new AbstractSet<A> { public Iterator<A> iterator() { throw unimplemented(); } public int size() { ret -1; } @Override public bool contains(O o) { ret p.get((A) o); } }; }
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: | 196 / 285 |
Version history: | 2 change(s) |
Referenced in: | [show references] |