package org.terracotta.offheapstore;
public final class MetadataTuple<V> {
private final V value;
private final int metadata;
private MetadataTuple(V value, int metadata) {
this.value = value;
this.metadata = metadata;
}
public V value() {
return value;
}
public int metadata() {
return metadata;
}
@Override
public boolean equals(Object o) {
if (o instanceof MetadataTuple<?>) {
MetadataTuple<?> other = (MetadataTuple<?>) o;
return value().equals(other.value()) && metadata() == other.metadata();
} else {
return false;
}
}
@Override
public int hashCode() {
return value.hashCode() ^ metadata;
}
public static <T> MetadataTuple<T> metadataTuple(T value, int metadata) {
return new MetadataTuple<>(value, metadata);
}
}