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
The newest version!
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
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;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy