1 /*
2 * File: ImmutableMapEntry.java
3 * Created: 12-čen-06 4:06:44
4 *
5 * Copyright 2006 Michal Burda.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21 package net.sf.webmancer.util.immutable;
22
23 import java.util.Map;
24
25 /**
26 * @author Michal Burda
27 * @param <K>
28 * @param <V>
29 */
30 public final class ImmutableMapEntry<K, V> implements Map.Entry<K, V> {
31 /**
32 *
33 */
34 private Map.Entry<? extends K, ? extends V> mapEntry;
35
36 /**
37 * @param mapEntry
38 */
39 public ImmutableMapEntry(final Map.Entry<? extends K, ? extends V> mapEntry) {
40 super();
41 this.mapEntry = mapEntry;
42 }
43
44 /**
45 * @see java.util.Map.Entry#equals(java.lang.Object)
46 */
47 @Override
48 public boolean equals(final Object o) {
49 return this.mapEntry.equals(o);
50 }
51
52 /**
53 * @see java.util.Map.Entry#getKey()
54 */
55 public K getKey() {
56 return this.mapEntry.getKey();
57 }
58
59 /**
60 * @see java.util.Map.Entry#getValue()
61 */
62 public V getValue() {
63 return this.mapEntry.getValue();
64 }
65
66 /**
67 * @see java.util.Map.Entry#hashCode()
68 */
69 @Override
70 public int hashCode() {
71 return this.mapEntry.hashCode();
72 }
73
74 /**
75 * @see java.util.Map.Entry#setValue(V)
76 */
77 public V setValue(final V value) {
78 throw new UnsupportedOperationException("ImmutableMapEntry.setValue");
79 }
80
81 }