CounterCell implements Counter, MetricCell<Long> { @Override public boolean equals(@Nullable Object object) { if (object instanceof CounterCell) { CounterCell counterCell = (CounterCell) object; return Objects.equals(dirty, counterCell.dirty) && Objects.equals(value.get(), counterCell.value.get()) && Objects.equals(name, counterCell.name); } return false; } CounterCell(MetricName name); @Override void reset(); @Override void inc(long n); @Override void inc(); @Override void dec(); @Override void dec(long n); @Override DirtyState getDirty(); @Override Long getCumulative(); @Override MetricName getName(); @Override boolean equals(@Nullable Object object); @Override int hashCode();  }
@Test public void testEquals() { CounterCell counterCell = new CounterCell(MetricName.named("namespace", "name")); CounterCell equal = new CounterCell(MetricName.named("namespace", "name")); Assert.assertEquals(counterCell, equal); Assert.assertEquals(counterCell.hashCode(), equal.hashCode()); }