001package org.apache.commons.jcs.utils.struct; 002 003/* 004 * Licensed to the Apache Software Foundation (ASF) under one 005 * or more contributor license agreements. See the NOTICE file 006 * distributed with this work for additional information 007 * regarding copyright ownership. The ASF licenses this file 008 * to you under the Apache License, Version 2.0 (the 009 * "License"); you may not use this file except in compliance 010 * with the License. You may obtain a copy of the License at 011 * 012 * http://www.apache.org/licenses/LICENSE-2.0 013 * 014 * Unless required by applicable law or agreed to in writing, 015 * software distributed under the License is distributed on an 016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 017 * KIND, either express or implied. See the License for the 018 * specific language governing permissions and limitations 019 * under the License. 020 */ 021 022import java.io.Serializable; 023import java.util.Map.Entry; 024 025/** 026 * Entry for the LRUMap. 027 * <p> 028 * @author Aaron Smuts 029 */ 030public class LRUMapEntry<K, V> 031 implements Entry<K, V>, Serializable 032{ 033 /** Don't change */ 034 private static final long serialVersionUID = -8176116317739129331L; 035 036 /** key */ 037 private final K key; 038 039 /** value */ 040 private V value; 041 042 /** 043 * S 044 * @param key 045 * @param value 046 */ 047 public LRUMapEntry(K key, V value) 048 { 049 this.key = key; 050 this.value = value; 051 } 052 053 /** 054 * @return key 055 */ 056 @Override 057 public K getKey() 058 { 059 return this.key; 060 } 061 062 /** 063 * @return value 064 */ 065 @Override 066 public V getValue() 067 { 068 return this.value; 069 } 070 071 /** 072 * @param valueArg 073 * @return the old value 074 */ 075 @Override 076 public V setValue(V valueArg) 077 { 078 V old = this.value; 079 this.value = valueArg; 080 return old; 081 } 082}