GaugeCell implements Gauge, MetricCell<GaugeData> { @Override public boolean equals(@Nullable Object object) { if (object instanceof GaugeCell) { GaugeCell gaugeCell = (GaugeCell) object; return Objects.equals(dirty, gaugeCell.dirty) && Objects.equals(gaugeValue.get(), gaugeCell.gaugeValue.get()) && Objects.equals(name, gaugeCell.name); } return false; } GaugeCell(MetricName name); @Override void reset(); @Override void set(long value); @Override DirtyState getDirty(); @Override GaugeData getCumulative(); @Override MetricName getName(); @Override boolean equals(@Nullable Object object); @Override int hashCode();  }
@Test public void testEquals() { GaugeCell gaugeCell = new GaugeCell(MetricName.named("namespace", "name")); GaugeCell equal = new GaugeCell(MetricName.named("namespace", "name")); Assert.assertEquals(gaugeCell, equal); Assert.assertEquals(gaugeCell.hashCode(), equal.hashCode()); }