mirror of
https://github.com/signalapp/Signal-Server
synced 2026-04-21 06:38:04 +01:00
Replace MultiRecipientMessage parsing with libsignal's implementation
Co-authored-by: Jonathan Klabunde Tomer <jkt@signal.org>
This commit is contained in:
@@ -4,32 +4,14 @@
|
||||
*/
|
||||
package org.whispersystems.textsecuregcm.util;
|
||||
|
||||
import static com.google.common.base.Objects.equal;
|
||||
import java.util.Map;
|
||||
|
||||
public class Pair<T1, T2> {
|
||||
private final T1 v1;
|
||||
private final T2 v2;
|
||||
|
||||
public Pair(T1 v1, T2 v2) {
|
||||
this.v1 = v1;
|
||||
this.v2 = v2;
|
||||
public record Pair<T1, T2>(T1 first, T2 second) {
|
||||
public Pair(org.signal.libsignal.protocol.util.Pair<T1, T2> p) {
|
||||
this(p.first(), p.second());
|
||||
}
|
||||
|
||||
public T1 first() {
|
||||
return v1;
|
||||
}
|
||||
|
||||
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();
|
||||
public Pair(Map.Entry<T1, T2> e) {
|
||||
this(e.getKey(), e.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user