1/* GENERATED SOURCE. DO NOT MODIFY. */ 2// © 2016 and later: Unicode, Inc. and others. 3// License & terms of use: http://www.unicode.org/copyright.html#License 4/* 5 ******************************************************************************* 6 * Copyright (C) 2014, International Business Machines Corporation and 7 * others. All Rights Reserved. 8 ******************************************************************************* 9 */ 10package android.icu.impl; 11 12/** 13 * A pair of objects: first and second. 14 * 15 * @param <F> first object type 16 * @param <S> second object type 17 * @hide Only a subset of ICU is exposed in Android 18 */ 19public class Pair<F, S> { 20 public final F first; 21 public final S second; 22 23 protected Pair(F first, S second) { 24 this.first = first; 25 this.second = second; 26 } 27 28 /** 29 * Creates a pair object 30 * @param first must be non-null 31 * @param second must be non-null 32 * @return The pair object. 33 */ 34 public static <F, S> Pair<F, S> of(F first, S second) { 35 if (first == null || second == null) { 36 throw new IllegalArgumentException("Pair.of requires non null values."); 37 } 38 return new Pair<F, S>(first, second); 39 } 40 41 @Override 42 public boolean equals(Object other) { 43 if (other == this) { 44 return true; 45 } 46 if (!(other instanceof Pair)) { 47 return false; 48 } 49 Pair<?, ?> rhs = (Pair<?, ?>) other; 50 return first.equals(rhs.first) && second.equals(rhs.second); 51 } 52 53 @Override 54 public int hashCode() { 55 return first.hashCode() * 37 + second.hashCode(); 56 } 57} 58