1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
13   */
14  
15  package com.liferay.portal.kernel.util;
16  
17  import java.io.Serializable;
18  
19  /**
20   * <a href="ObjectValuePair.java.html"><b><i>View Source</i></b></a>
21   *
22   * @author Brian Wing Shun Chan
23   */
24  public class ObjectValuePair<K, V> implements Serializable {
25  
26      public ObjectValuePair() {
27      }
28  
29      public ObjectValuePair(K key, V value) {
30          _key = key;
31          _value = value;
32      }
33  
34      public K getKey() {
35          return _key;
36      }
37  
38      public void setKey(K key) {
39          _key = key;
40      }
41  
42      public V getValue() {
43          return _value;
44      }
45  
46      public void setValue(V value) {
47          _value = value;
48      }
49  
50      public boolean equals(Object obj) {
51          if (obj == null) {
52              return false;
53          }
54  
55          ObjectValuePair<K, V> ovp = (ObjectValuePair<K, V>)obj;
56  
57          K key = ovp.getKey();
58  
59          if (_key.equals(key)) {
60              return true;
61          }
62          else {
63              return false;
64          }
65      }
66  
67      public int hashCode() {
68          return _key.hashCode();
69      }
70  
71      private K _key;
72      private V _value;
73  
74  }