All Downloads are FREE. Search and download functionalities are using the official Maven repository.

gw.internal.gosu.util.LRUMap Maven / Gradle / Ivy

There is a newer version: 1.18.2
Show newest version
/*
 * Copyright 2014 Guidewire Software, Inc.
 */

package gw.internal.gosu.util;

import java.util.LinkedHashMap;
import java.util.Map;

/**
 * This is a very simple implementation of an LRUMap using the
 * LinkedHashMap special constructor.
 */
public class LRUMap extends LinkedHashMap
{
  private int _maxEntries;

  public LRUMap(int maxEntries)
  {
    super(maxEntries, .75F, true);
    _maxEntries = maxEntries;
  }

  @Override
  protected boolean removeEldestEntry( Map.Entry eldest )
  {
    return size() > _maxEntries;
  }
  
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy