Rework messages API to fail if you miss some deviceIds per number

This commit is contained in:
Matt Corallo
2014-01-09 15:20:06 -10:00
parent 918ef4a7ca
commit 8c74ad073b
6 changed files with 183 additions and 66 deletions

View File

@@ -1,10 +1,12 @@
package org.whispersystems.textsecuregcm.util;
import static com.google.common.base.Objects.equal;
public class Pair<T1, T2> {
private final T1 v1;
private final T2 v2;
Pair(T1 v1, T2 v2) {
public Pair(T1 v1, T2 v2) {
this.v1 = v1;
this.v2 = v2;
}
@@ -16,4 +18,14 @@ public class Pair<T1, T2> {
public T2 second(){
return v2;
}
public boolean equals(Object o) {
return o instanceof Pair &&
equal(((Pair) o).first(), first()) &&
equal(((Pair) o).second(), second());
}
public int hashCode() {
return first().hashCode() ^ second().hashCode();
}
}