Libraryless. Click here for Pure Java version (2576L/16K).
1 | // elements are put to front when added (not when accessed) |
2 | persistable sclass MRUCache<A, B> extends LinkedHashMap<A, B> {
|
3 | int maxSize = 10; |
4 | |
5 | *() {}
|
6 | *(int *maxSize) {}
|
7 | |
8 | protected bool removeEldestEntry(Map.Entry eldest) {
|
9 | ret size() > maxSize; |
10 | } |
11 | |
12 | O _serialize() {
|
13 | ret ll(maxSize, cloneLinkedHashMap(this)); |
14 | } |
15 | |
16 | static MRUCache _deserialize(L l) {
|
17 | new MRUCache m; |
18 | m.maxSize = (int) first(l); |
19 | m.putAll((LinkedHashMap) second(l)); |
20 | ret m; |
21 | } |
22 | } |
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: | 1001 / 3044 |
| Version history: | 5 change(s) |
| Referenced in: | [show references] |