| OLD | NEW | 
| (Empty) |  | 
 |   1 /* | 
 |   2  * Copyright (C) 2012 René Jeschke <rene_jeschke@yahoo.de> | 
 |   3  * | 
 |   4  * Licensed under the Apache License, Version 2.0 (the "License"); | 
 |   5  * you may not use this file except in compliance with the License. | 
 |   6  * You may obtain a copy of the License at | 
 |   7  * | 
 |   8  *     http://www.apache.org/licenses/LICENSE-2.0 | 
 |   9  * | 
 |  10  * Unless required by applicable law or agreed to in writing, software | 
 |  11  * distributed under the License is distributed on an "AS IS" BASIS, | 
 |  12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 
 |  13  * See the License for the specific language governing permissions and | 
 |  14  * limitations under the License. | 
 |  15  */ | 
 |  16 package com.github.rjeschke.neetutils.collections; | 
 |  17  | 
 |  18 import com.github.rjeschke.neetutils.Objects; | 
 |  19  | 
 |  20 /** | 
 |  21  *  | 
 |  22  * @author René Jeschke (rene_jeschke@yahoo.de) | 
 |  23  *  | 
 |  24  * @param <A> | 
 |  25  * @param <B> | 
 |  26  */ | 
 |  27 public class Tuple<A, B> | 
 |  28 { | 
 |  29   public final A a; | 
 |  30   public final B b; | 
 |  31  | 
 |  32   public Tuple(final A a, final B b) | 
 |  33   { | 
 |  34     this.a = a; | 
 |  35     this.b = b; | 
 |  36   } | 
 |  37  | 
 |  38   public final static <A, B> Tuple<A, B> of(final A a, final B b) | 
 |  39   { | 
 |  40     return new Tuple<A, B>(a, b); | 
 |  41   } | 
 |  42  | 
 |  43   @Override | 
 |  44   public int hashCode() | 
 |  45   { | 
 |  46     return (this.a == null ? 0 : this.a.hashCode()) * 31 + (this.b == null ? 0 :
     this.b.hashCode()); | 
 |  47   } | 
 |  48  | 
 |  49   @Override | 
 |  50   public boolean equals(final Object obj) | 
 |  51   { | 
 |  52     if (obj == this) | 
 |  53     { | 
 |  54       return true; | 
 |  55     } | 
 |  56  | 
 |  57     if (!(obj instanceof Tuple)) | 
 |  58     { | 
 |  59       return false; | 
 |  60     } | 
 |  61  | 
 |  62     final Tuple<?, ?> p = (Tuple<?, ?>)obj; | 
 |  63  | 
 |  64     return Objects.equals(this.a, p.a) && Objects.equals(this.b, p.b); | 
 |  65   } | 
 |  66  | 
 |  67   @Override | 
 |  68   public String toString() | 
 |  69   { | 
 |  70     return "(" + this.a.toString() + ", " + this.b.toString() + ")"; | 
 |  71   } | 
 |  72 } | 
| OLD | NEW |