Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

9
LINES

< > BotCompany Repo | #1021547 // wrapF1WithCache

JavaX fragment (include)

static <A, B> F1<A, B> wrapF1WithCache(final Map<A, B> cache, final F1<A, B> f) {
  if (cache == null) ret f;
  if (f == null) null;
  ret func(A a) -> B {
    B b = cache.get(a);
    if (b == null) cache.put(a, b = callF(f, a));
    ret b;
  };
}

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: 263 / 270
Version history: 2 change(s)
Referenced in: [show references]