1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
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      private K _key;
68      private V _value;
69  
70  }