com.microsoft.azure.servicebus.primitives.Pair Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-servicebus Show documentation
Show all versions of azure-servicebus Show documentation
Java library for Azure Service Bus. Please note, a newer package com.azure:azure-messaging-servicebus for Azure Service Bus is available as of December 2020. While this package will continue to receive critical bug fixes, we strongly encourage you to upgrade. Read the migration guide at https://aka.ms/azsdk/java/migrate/sb for more details.
package com.microsoft.azure.servicebus.primitives;
// Utility class to encapsulate any pair
public class Pair
{
private T t;
private V v;
Pair(T t, V v)
{
this.t= t;
this.v = v;
}
public T getFirstItem() {
return t;
}
public V getSecondItem() {
return v;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((t == null) ? 0 : t.hashCode());
result = prime * result + ((v == null) ? 0 : v.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Pair other = (Pair) obj;
if (t == null) {
if (other.t != null)
return false;
} else if (!t.equals(other.t))
return false;
if (v == null) {
if (other.v != null)
return false;
} else if (!v.equals(other.v))
return false;
return true;
}
}