Pair.java revision 1472:c18cbe5936b8
1/*
2 * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24package com.sun.hotspot.igv.data;
25
26/**
27 *
28 * @author Thomas Wuerthinger
29 */
30public class Pair<L, R> {
31
32    private L l;
33    private R r;
34
35    public Pair() {
36    }
37
38    public Pair(L l, R r) {
39        this.l = l;
40        this.r = r;
41    }
42
43    public L getLeft() {
44        return l;
45    }
46
47    public void setLeft(L l) {
48        this.l = l;
49    }
50
51    public R getRight() {
52        return r;
53    }
54
55    public void setRight(R r) {
56        this.r = r;
57    }
58
59    @Override
60    public boolean equals(Object o) {
61        if (!(o instanceof Pair)) {
62            return false;
63        }
64        Pair obj = (Pair) o;
65        return l.equals(obj.l) && r.equals(obj.r);
66    }
67
68    @Override
69    public int hashCode() {
70        return l.hashCode() * 71 + r.hashCode();
71    }
72}
73