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

19
LINES

< > BotCompany Repo | #1022395 // MechListDependentCaches

JavaX fragment (include)

sclass MechListDependentCaches<A> {
  Map<S, MechListDependentCache<A>> byList = ciMap();
  O maker; // func(S) -> A
  transient Lock lock = lock();
  
  *(O *maker) {}

  A get(S name) {
    MechListDependentCache<A> listCache;
    {
      lock lock;
      listCache = byList.get(name);
      if (listCache == null)
        byList.put(name, listCache
          = MechListDependentCache(name, maker));
    }
    ret listCache!;
  }
}

Author comment

Began life as a copy of #1022393

download  show line numbers  debug dex  old transpilations   

Travelled to 9 computer(s): bhatertpkbcr, cfunsshuasjs, lnbujpyubztb, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, whxojlpjdney

No comments. add comment

Snippet ID: #1022395
Snippet name: MechListDependentCaches
Eternal ID of this version: #1022395/5
Text MD5: 204a685786ba06cd1bdc8e5d9301c5f8
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-03-16 17:25:12
Source code size: 451 bytes / 19 lines
Pitched / IR pitched: No / No
Views / Downloads: 341 / 832
Version history: 4 change(s)
Referenced in: #1034167 - Standard Classes + Interfaces (LIVE, continuation of #1003674)