Add the equals method to IceServer.

Bug: None
Change-Id: I4bac54489a44a4577cc221ba51351e4a3a92e69b
Reviewed-on: https://webrtc-review.googlesource.com/c/116081
Commit-Queue: Qingsi Wang <qingsi@webrtc.org>
Reviewed-by: Honghai Zhang <honghaiz@webrtc.org>
Reviewed-by: Alex Glaznev <glaznev@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26271}
This commit is contained in:
Qingsi Wang
2019-01-15 13:33:11 -08:00
committed by Commit Bot
parent 5586d7fb57
commit a0d4580936
2 changed files with 131 additions and 0 deletions

View File

@ -12,6 +12,7 @@ package org.webrtc;
import android.support.annotation.Nullable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.webrtc.DataChannel;
@ -222,6 +223,31 @@ public class PeerConnection {
+ "] [" + tlsAlpnProtocols + "] [" + tlsEllipticCurves + "]";
}
@Override
public boolean equals(@Nullable Object obj) {
if (obj == null) {
return false;
}
if (obj == this) {
return true;
}
if (!(obj instanceof IceServer)) {
return false;
}
IceServer other = (IceServer) obj;
return (uri.equals(other.uri) && urls.equals(other.urls) && username.equals(other.username)
&& password.equals(other.password) && tlsCertPolicy.equals(other.tlsCertPolicy)
&& hostname.equals(other.hostname) && tlsAlpnProtocols.equals(other.tlsAlpnProtocols)
&& tlsEllipticCurves.equals(other.tlsEllipticCurves));
}
@Override
public int hashCode() {
Object[] values = {uri, urls, username, password, tlsCertPolicy, hostname, tlsAlpnProtocols,
tlsEllipticCurves};
return Arrays.hashCode(values);
}
public static Builder builder(String uri) {
return new Builder(Collections.singletonList(uri));
}