/** * Copyright 2010 Ryszard Wiśniewski <brut.alll@gmail.com> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package brut.util; /** * @author Ryszard Wiśniewski <brut.alll@gmail.com> */ public class Duo<T1, T2> { public final T1 m1; public final T2 m2; public Duo(T1 t1, T2 t2) { this.m1 = t1; this.m2 = t2; } @Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Duo<T1, T2> other = (Duo<T1, T2>) obj; if (this.m1 != other.m1 && (this.m1 == null || !this.m1.equals(other.m1))) { return false; } if (this.m2 != other.m2 && (this.m2 == null || !this.m2.equals(other.m2))) { return false; } return true; } @Override public int hashCode() { int hash = 3; hash = 71 * hash + (this.m1 != null ? this.m1.hashCode() : 0); hash = 71 * hash + (this.m2 != null ? this.m2.hashCode() : 0); return hash; } }