01: /*
02: * Copyright 2001-2006 The Apache Software Foundation
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
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 <code>Map.Entry</code> contract from being broken.
25: *
26: * @since Commons Collections 3.0
27: * @version $Revision: 405927 $ $Date: 2006-05-12 23:57:03 +0100 (Fri, 12 May 2006) $
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 <code>KeyValue</code>.
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 <code>Map.Entry</code>.
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: }
|