⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lrucache.java

📁 JGAP(发音"jay-gap")是一款用Java编写的遗传算法包。提供了基本的遗传算法.你可以使用它来解决一些适用于遗传算法解决的问题.
💻 JAVA
字号:
package org.jgap.util;

import java.util.*;

public class LRUCache extends LinkedHashMap {
  // Create cache

  private int m_maxEntries;

  public LRUCache(int a_maxExtries) {
    super(a_maxExtries+1, 0.75F, true);
    m_maxEntries = a_maxExtries;
  }
    // This method is called just after a new entry has been added
    public boolean removeEldestEntry(Map.Entry eldest) {
      return size() > m_maxEntries;
    }

  // If the cache is to be used by multiple threads,
  // the cache must be wrapped with code to synchronize the methods
//  cache = (Map) Collections.synchronizedMap(cache);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -