am 21e57216: Merge "Fix a possible NPE in Dicttool"
* commit '21e57216e15d236764a5e00ca5614ec67d23159f': Fix a possible NPE in Dicttoolmain
commit
0bd603e7f7
|
@ -17,6 +17,7 @@
|
||||||
package android.util;
|
package android.util;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
public class Pair<T1, T2> {
|
public class Pair<T1, T2> {
|
||||||
public final T1 mFirst;
|
public final T1 mFirst;
|
||||||
|
@ -29,7 +30,8 @@ public class Pair<T1, T2> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Arrays.hashCode(new Object[] { mFirst, mSecond });
|
return (mFirst == null ? 0 : mFirst.hashCode())
|
||||||
|
^ (mSecond == null ? 0 : mSecond.hashCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -37,7 +39,6 @@ public class Pair<T1, T2> {
|
||||||
if (o == this) return true;
|
if (o == this) return true;
|
||||||
if (!(o instanceof Pair)) return false;
|
if (!(o instanceof Pair)) return false;
|
||||||
Pair<?, ?> p = (Pair<?, ?>)o;
|
Pair<?, ?> p = (Pair<?, ?>)o;
|
||||||
return ((mFirst == null && p.mFirst == null) || mFirst.equals(p.mFirst))
|
return Objects.equals(mFirst, p.mFirst) && Objects.equals(mSecond, p.mSecond);
|
||||||
&& ((mSecond == null && p.mSecond == null) || mSecond.equals(p.mSecond));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue