Java tutorial
package android.support.v4.util; public class Pair<F, S> { public final F first; public final S second; public Pair(F f, S s) { this.first = f; this.second = s; } public boolean equals(Object obj) { if (!(obj instanceof Pair)) { return false; } Pair pair = (Pair) obj; if (objectsEqual(pair.first, this.first) && objectsEqual(pair.second, this.second)) { return true; } return false; } private static boolean objectsEqual(Object obj, Object obj2) { return obj == obj2 || (obj != null && obj.equals(obj2)); } public int hashCode() { int i = 0; int hashCode = this.first == null ? 0 : this.first.hashCode(); if (this.second != null) { i = this.second.hashCode(); } return hashCode ^ i; } public static <A, B> Pair<A, B> create(A a, B b) { return new Pair(a, b); } }