1 package org.apache.commons.jcs.utils.struct;
2
3 /*
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
19 * under the License.
20 */
21
22 import java.io.Serializable;
23 import java.util.Map.Entry;
24
25 /**
26 * Entry for the LRUMap.
27 * <p>
28 * @author Aaron Smuts
29 */
30 public class LRUMapEntry<K, V>
31 implements Entry<K, V>, Serializable
32 {
33 /** Don't change */
34 private static final long serialVersionUID = -8176116317739129331L;
35
36 /** key */
37 private final K key;
38
39 /** value */
40 private V value;
41
42 /**
43 * S
44 * @param key
45 * @param value
46 */
47 public LRUMapEntry(K key, V value)
48 {
49 this.key = key;
50 this.value = value;
51 }
52
53 /**
54 * @return key
55 */
56 @Override
57 public K getKey()
58 {
59 return this.key;
60 }
61
62 /**
63 * @return value
64 */
65 @Override
66 public V getValue()
67 {
68 return this.value;
69 }
70
71 /**
72 * @param valueArg
73 * @return the old value
74 */
75 @Override
76 public V setValue(V valueArg)
77 {
78 V old = this.value;
79 this.value = valueArg;
80 return old;
81 }
82 }