Libraryless. Click here for Pure Java version (2576L/16K).
// elements are put to front when added (not when accessed) persistable sclass MRUCache<A, B> extends LinkedHashMap<A, B> { int maxSize = 10; *() {} *(int *maxSize) {} protected bool removeEldestEntry(Map.Entry eldest) { ret size() > maxSize; } O _serialize() { ret ll(maxSize, cloneLinkedHashMap(this)); } static MRUCache _deserialize(L l) { new MRUCache m; m.maxSize = (int) first(l); m.putAll((LinkedHashMap) second(l)); ret m; } }
download show line numbers debug dex old transpilations
Travelled to 23 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ekrmjmnbrukm, gwrvuhgaqvyk, hpgrupgrauku, ishqpsrjomds, lpdgvwnxivlt, mowyntqkapby, mqqgnosmbjvj, ofpaelxlmzfo, omdjrrnzbjjv, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, rjpzpeejafvs, snaazhdonpnp, tslmcundralx, tvejysmllsmz, vouqrxazstgt, whxojlpjdney, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1008915 |
Snippet name: | MRUCache |
Eternal ID of this version: | #1008915/6 |
Text MD5: | d793e0103924b8f0b67256475eef12d8 |
Transpilation MD5: | 3810cd2a97ce4bc5c0ede3462ecb9a0a |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-11-09 09:29:43 |
Source code size: | 507 bytes / 22 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 736 / 2728 |
Version history: | 5 change(s) |
Referenced in: | #1034167 - Standard Classes + Interfaces (LIVE, continuation of #1003674) |