1   /*
2    *  Copyright 2001-2004 The Apache Software Foundation
3    *
4    *  Licensed under the Apache License, Version 2.0 (the "License");
5    *  you may not use this file except in compliance with the License.
6    *  You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
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 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  }