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

11
LINES

< > TinyBrain | #1008915 - MRUCache

JavaX fragment (include)

// elements are put to front when added (not when accessed)
sclass MRUCache<A, B> extends LinkedHashMap<A, B> {
  int maxSize = 10;

  *() {}
  *(int *maxSize) {}
  
  protected bool removeEldestEntry(Map.Entry eldest) {
    ret size() > maxSize;
  }
}

download  show line numbers  debug dex   

Travelled to 2 computer(s): cfunsshuasjs, tvejysmllsmz

No comments. add comment

Snippet ID: #1008915
Snippet name: MRUCache
Eternal ID of this version: #1008915/1
Text MD5: 3a2c019512c859b50bbb86d41e633f1d
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-06-18 17:23:53
Source code size: 262 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 33 / 61
Referenced in: [show]