This class is not thread-safe.
| Modifier and Type | Field and Description |
|---|---|
| private final int | |
| private static final long |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected boolean | removeEldestEntry(Map.
Overrides java. Returns |
| maxSize | back to summary |
|---|---|
| private final int maxSize | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Hides java. | |
| LruCache | back to summary |
|---|---|
| public LruCache(int maxSize) Create a new LRU cache that maintains at most the supplied number of entries. For optimal use of the internal data structures, you should pick a
number that's one below a power of two since this is based on a
| |
| removeEldestEntry | back to summary |
|---|---|
| protected boolean removeEldestEntry(Map. Overrides java. Doc from java. Returns Sample use: this override will allow the map to grow up to 100 entries and then delete the eldest entry each time a new entry is added, maintaining a steady state of 100 entries.
private static final int MAX_ENTRIES = 100;
protected boolean removeEldestEntry(Map.Entry eldest) {
return size() > MAX_ENTRIES;
}
This method typically does not modify the map in any way,
instead allowing the map to modify itself as directed by its
return value. It is permitted for this method to modify
the map directly, but if it does so, it must return
This implementation merely returns
| |