Metric { @Override public int hashCode() { int result = config.hashCode(); result = 31 * result + (int) (timestamp ^ (timestamp >>> 32)); result = 31 * result + value.hashCode(); return result; } Metric(String name, TagList tags, long timestamp, Object value);  Metric(MonitorConfig config, long timestamp, Object value); MonitorConfig getConfig(); long getTimestamp(); Object getValue(); Number getNumberValue(); boolean hasNumberValue(); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString();  }
@Test public void testHashCode() throws Exception { long now = System.currentTimeMillis(); Metric m1 = new Metric("a", tags1, now, 42); Metric m2 = new Metric("a", tags2, now, 42); Metric m3 = new Metric("a", tags1, now, 42); assertTrue(m1.hashCode() == m1.hashCode()); assertTrue(m1.hashCode() != m2.hashCode()); assertTrue(m1.hashCode() == m3.hashCode()); }