1 /******************************************************************************* 2 * Copyright (c) 2000, 2006 IBM Corporation and others. 3 * All rights reserved. This program and the accompanying materials 4 * are made available under the terms of the Eclipse Public License v1.0 5 * which accompanies this distribution, and is available at 6 * http://www.eclipse.org/legal/epl-v10.html 7 * 8 * Contributors: 9 * IBM Corporation - initial API and implementation 10 *******************************************************************************/ 11 package org.eclipse.jdt.internal.core.util; 12 13 import java.util.Enumeration; 14 15 /** 16 * The <code>ICacheEnumeration</code> is used to iterate over both the keys 17 * and values in an LRUCache. The <code>getValue()</code> method returns the 18 * value of the last key to be retrieved using <code>nextElement()</code>. 19 * The <code>nextElement()</code> method must be called before the 20 * <code>getValue()</code> method. 21 * 22 * <p>The iteration can be made efficient by making use of the fact that values in 23 * the cache (instances of <code>LRUCacheEntry</code>), know their key. For this reason, 24 * Hashtable lookups don't have to be made at each step of the iteration. 25 * 26 * <p>Modifications to the cache must not be performed while using the 27 * enumeration. Doing so will lead to an illegal state. 28 * 29 * @see LRUCache 30 */ 31 public interface ICacheEnumeration extends Enumeration { 32 /** 33 * Returns the value of the previously accessed key in the enumeration. 34 * Must be called after a call to nextElement(). 35 * 36 * @return Value of current cache entry 37 */ 38 public Object getValue(); 39 } 40