001 /*
002 * This file is part of the Jikes RVM project (http://jikesrvm.org).
003 *
004 * This file is licensed to You under the Eclipse Public License (EPL);
005 * You may not use this file except in compliance with the License. You
006 * may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/eclipse-1.0.php
009 *
010 * See the COPYRIGHT.txt file distributed with this work for information
011 * regarding copyright ownership.
012 */
013
014 package org.jikesrvm.util;
015
016 public class Pair<X, Y> {
017 public final X first;
018 public final Y second;
019
020 public Pair(X f, Y s) {
021 first = f;
022 second = s;
023 }
024
025 public int hashCode() {
026 return (first.hashCode() | second.hashCode());
027 }
028
029 public boolean equals(Object o) {
030 if (o instanceof Pair<?, ?>) {
031 Pair<?, ?> p = (Pair<?, ?>) o;
032 return (first == p.first) && (second == p.second);
033 } else {
034 return false;
035 }
036 }
037 }