1 | static <A, B> F1<A, B> wrapF1WithCache(final Map<A, B> cache, final F1<A, B> f) {
|
2 | if (cache == null) ret f; |
3 | if (f == null) null; |
4 | ret func(A a) -> B {
|
5 | B b = cache.get(a); |
6 | if (b == null) cache.put(a, b = callF(f, a)); |
7 | ret b; |
8 | }; |
9 | } |
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: | #1021547 |
| Snippet name: | wrapF1WithCache |
| Eternal ID of this version: | #1021547/3 |
| Text MD5: | c5b946a4b7b83fe944b308ca71ce69ae |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2019-02-17 17:16:38 |
| Source code size: | 255 bytes / 9 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 595 / 601 |
| Version history: | 2 change(s) |
| Referenced in: | [show references] |