01: /*******************************************************************************
02: * Copyright (c) 2000, 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.jdt.internal.corext.util;
11:
12: import java.util.LinkedHashMap;
13:
14: /**
15: *
16: */
17: public class LRUMap extends LinkedHashMap {
18:
19: private static final long serialVersionUID = 1L;
20: private final int fMaxSize;
21:
22: public LRUMap(int maxSize) {
23: super (maxSize, 0.75f, true);
24: fMaxSize = maxSize;
25: }
26:
27: protected boolean removeEldestEntry(java.util.Map.Entry eldest) {
28: return size() > fMaxSize;
29: }
30: }
|