1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.apache.commons.collections.keyvalue;
17
18 import java.util.Map;
19
20 import org.apache.commons.collections.KeyValue;
21
22 /**
23 * A restricted implementation of {@link java.util.Map.Entry} that prevents
24 * the MapEntry contract from being broken.
25 *
26 * @since Commons Collections 3.0
27 * @version $Revision: 1.1 $ $Date: 2004/05/10 19:53:16 $
28 *
29 * @author James Strachan
30 * @author Michael A. Smith
31 * @author Neil O'Toole
32 * @author Stephen Colebourne
33 */
34 public final class DefaultMapEntry extends AbstractMapEntry {
35
36 /**
37 * Constructs a new entry with the specified key and given value.
38 *
39 * @param key the key for the entry, may be null
40 * @param value the value for the entry, may be null
41 */
42 public DefaultMapEntry(final Object key, final Object value) {
43 super(key, value);
44 }
45
46 /**
47 * Constructs a new entry from the specified KeyValue.
48 *
49 * @param pair the pair to copy, must not be null
50 * @throws NullPointerException if the entry is null
51 */
52 public DefaultMapEntry(final KeyValue pair) {
53 super(pair.getKey(), pair.getValue());
54 }
55
56 /**
57 * Constructs a new entry from the specified MapEntry.
58 *
59 * @param entry the entry to copy, must not be null
60 * @throws NullPointerException if the entry is null
61 */
62 public DefaultMapEntry(final Map.Entry entry) {
63 super(entry.getKey(), entry.getValue());
64 }
65
66 }