Use java.util.Objects instead on internal API

Not needed since java.util.Objects implements all the needed
functionality.

Change-Id: Icd31d49a9801d1705427f028e9ac927d58e7d34c
This commit is contained in:
Kenny Root
2013-12-13 12:00:26 -08:00
parent fb4d3e7a4a
commit 9254db342a
4 changed files with 17 additions and 16 deletions

View File

@@ -26,7 +26,7 @@ import android.net.wifi.WifiManager;
import android.os.Build;
import android.telephony.TelephonyManager;
import com.android.internal.util.Objects;
import java.util.Objects;
/**
* Network definition that includes strong identity. Analogous to combining
@@ -60,7 +60,7 @@ public class NetworkIdentity {
@Override
public int hashCode() {
return Objects.hashCode(mType, mSubType, mSubscriberId, mNetworkId, mRoaming);
return Objects.hash(mType, mSubType, mSubscriberId, mNetworkId, mRoaming);
}
@Override
@@ -68,8 +68,8 @@ public class NetworkIdentity {
if (obj instanceof NetworkIdentity) {
final NetworkIdentity ident = (NetworkIdentity) obj;
return mType == ident.mType && mSubType == ident.mSubType && mRoaming == ident.mRoaming
&& Objects.equal(mSubscriberId, ident.mSubscriberId)
&& Objects.equal(mNetworkId, ident.mNetworkId);
&& Objects.equals(mSubscriberId, ident.mSubscriberId)
&& Objects.equals(mNetworkId, ident.mNetworkId);
}
return false;
}

View File

@@ -23,12 +23,12 @@ import android.util.SparseBooleanArray;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.util.ArrayUtils;
import com.android.internal.util.Objects;
import java.io.CharArrayWriter;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Objects;
/**
* Collection of active network statistics. Can contain summary details across
@@ -337,7 +337,7 @@ public class NetworkStats implements Parcelable {
public int findIndex(String iface, int uid, int set, int tag) {
for (int i = 0; i < size; i++) {
if (uid == this.uid[i] && set == this.set[i] && tag == this.tag[i]
&& Objects.equal(iface, this.iface[i])) {
&& Objects.equals(iface, this.iface[i])) {
return i;
}
}
@@ -362,7 +362,7 @@ public class NetworkStats implements Parcelable {
}
if (uid == this.uid[i] && set == this.set[i] && tag == this.tag[i]
&& Objects.equal(iface, this.iface[i])) {
&& Objects.equals(iface, this.iface[i])) {
return i;
}
}

View File

@@ -34,8 +34,9 @@ import android.content.res.Resources;
import android.os.Parcel;
import android.os.Parcelable;
import java.util.Objects;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.util.Objects;
/**
* Template definition used to generically match {@link NetworkIdentity},
@@ -176,7 +177,7 @@ public class NetworkTemplate implements Parcelable {
@Override
public int hashCode() {
return Objects.hashCode(mMatchRule, mSubscriberId, mNetworkId);
return Objects.hash(mMatchRule, mSubscriberId, mNetworkId);
}
@Override
@@ -184,8 +185,8 @@ public class NetworkTemplate implements Parcelable {
if (obj instanceof NetworkTemplate) {
final NetworkTemplate other = (NetworkTemplate) obj;
return mMatchRule == other.mMatchRule
&& Objects.equal(mSubscriberId, other.mSubscriberId)
&& Objects.equal(mNetworkId, other.mNetworkId);
&& Objects.equals(mSubscriberId, other.mSubscriberId)
&& Objects.equals(mNetworkId, other.mNetworkId);
}
return false;
}
@@ -235,7 +236,7 @@ public class NetworkTemplate implements Parcelable {
return true;
} else {
return ((sForceAllNetworkTypes || contains(DATA_USAGE_NETWORK_TYPES, ident.mType))
&& Objects.equal(mSubscriberId, ident.mSubscriberId));
&& Objects.equals(mSubscriberId, ident.mSubscriberId));
}
}
@@ -280,7 +281,7 @@ public class NetworkTemplate implements Parcelable {
private boolean matchesWifi(NetworkIdentity ident) {
switch (ident.mType) {
case TYPE_WIFI:
return Objects.equal(
return Objects.equals(
removeDoubleQuotes(mNetworkId), removeDoubleQuotes(ident.mNetworkId));
default:
return false;

View File

@@ -34,7 +34,6 @@ import android.util.AtomicFile;
import com.android.internal.util.ArrayUtils;
import com.android.internal.util.FileRotator;
import com.android.internal.util.IndentingPrintWriter;
import com.android.internal.util.Objects;
import com.google.android.collect.Lists;
import com.google.android.collect.Maps;
@@ -50,6 +49,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import libcore.io.IoUtils;
@@ -508,7 +508,7 @@ public class NetworkStatsCollection implements FileRotator.Reader {
this.uid = uid;
this.set = set;
this.tag = tag;
hashCode = Objects.hashCode(ident, uid, set, tag);
hashCode = Objects.hash(ident, uid, set, tag);
}
@Override
@@ -521,7 +521,7 @@ public class NetworkStatsCollection implements FileRotator.Reader {
if (obj instanceof Key) {
final Key key = (Key) obj;
return uid == key.uid && set == key.set && tag == key.tag
&& Objects.equal(ident, key.ident);
&& Objects.equals(ident, key.ident);
}
return false;
}