### Question:
CpuFrequencyMetrics extends SystemMetrics<CpuFrequencyMetrics> { @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } CpuFrequencyMetrics that = (CpuFrequencyMetrics) o; if (timeInStateS.length != that.timeInStateS.length) { return false; } for (int i = 0, size = timeInStateS.length; i < size; i++) { if (!sparseIntArrayEquals(timeInStateS[i], that.timeInStateS[i])) { return false; } } return true; } CpuFrequencyMetrics(); @Override CpuFrequencyMetrics sum(
      @Nullable CpuFrequencyMetrics b, @Nullable CpuFrequencyMetrics output); @Override CpuFrequencyMetrics diff(
      @Nullable CpuFrequencyMetrics b, @Nullable CpuFrequencyMetrics output); @Override CpuFrequencyMetrics set(CpuFrequencyMetrics b); @Override boolean equals(Object o); static boolean sparseIntArrayEquals(SparseIntArray a, SparseIntArray b); @Override int hashCode(); @Override String toString(); @Nullable JSONObject toJSONObject(); final SparseIntArray[] timeInStateS; }### Answer:
@Test public void testEquals() { CpuFrequencyMetrics metricsA = new CpuFrequencyMetrics(); metricsA.timeInStateS[0].put(200, 2000); metricsA.timeInStateS[0].put(100, 1000); metricsA.timeInStateS[1].put(300, 3000); CpuFrequencyMetrics metricsB = new CpuFrequencyMetrics(); metricsB.timeInStateS[0].put(100, 1000); metricsB.timeInStateS[0].put(200, 2000); metricsB.timeInStateS[1].put(300, 3000); assertThat(metricsA).isEqualTo(metricsB); }