net.sf.javagimmicks.util8.PairImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gimmicks Show documentation
Show all versions of gimmicks Show documentation
Utility classes, APIs and tools for Java
package net.sf.javagimmicks.util8;
import java.util.Objects;
class PairImpl implements Pair
{
private final A _a;
private final B _b;
PairImpl(final A a, final B b)
{
this._a = a;
this._b = b;
}
@Override
public A getA()
{
return _a;
}
@Override
public B getB()
{
return _b;
}
@Override
public int hashCode()
{
return Objects.hash(_a, _b);
}
@Override
public boolean equals(final Object obj)
{
if (obj == null)
{
return false;
}
if (!(obj instanceof Pair, ?>))
{
return false;
}
final Pair, ?> otherPair = (Pair, ?>) obj;
return Objects.deepEquals(getA(), otherPair.getA()) && Objects.deepEquals(getB(), otherPair.getB());
}
@Override
public String toString()
{
return String.format("%s / %s", _a, _b);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy