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 @Override 026 public int hashCode() { 027 return (first.hashCode() | second.hashCode()); 028 } 029 030 @Override 031 public boolean equals(Object o) { 032 if (o instanceof Pair<?, ?>) { 033 Pair<?, ?> p = (Pair<?, ?>) o; 034 return (first == p.first) && (second == p.second); 035 } else { 036 return false; 037 } 038 } 039 }