### Question:
SlidingCategoryDataset extends AbstractDataset implements CategoryDataset { @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof SlidingCategoryDataset)) { return false; } SlidingCategoryDataset that = (SlidingCategoryDataset) obj; if (this.firstCategoryIndex != that.firstCategoryIndex) { return false; } if (this.maximumCategoryCount != that.maximumCategoryCount) { return false; } if (!this.underlying.equals(that.underlying)) { return false; } return true; } SlidingCategoryDataset(CategoryDataset underlying, int firstColumn,
            int maxColumns); CategoryDataset getUnderlyingDataset(); int getFirstCategoryIndex(); void setFirstCategoryIndex(int first); int getMaximumCategoryCount(); void setMaximumCategoryCount(int max); @Override int getColumnIndex(Comparable key); @Override Comparable getColumnKey(int column); @Override List<Comparable> getColumnKeys(); @Override int getRowIndex(Comparable key); @Override Comparable getRowKey(int row); @Override List<Comparable> getRowKeys(); @Override Number getValue(Comparable rowKey, Comparable columnKey); @Override int getColumnCount(); @Override int getRowCount(); @Override Number getValue(int row, int column); @Override boolean equals(Object obj); @Override Object clone();  }### Answer:
@Test public void testEquals() { DefaultCategoryDataset u1 = new DefaultCategoryDataset(); u1.addValue(1.0, "R1", "C1"); u1.addValue(2.0, "R1", "C2"); SlidingCategoryDataset d1 = new SlidingCategoryDataset(u1, 0, 5); DefaultCategoryDataset u2 = new DefaultCategoryDataset(); u2.addValue(1.0, "R1", "C1"); u2.addValue(2.0, "R1", "C2"); SlidingCategoryDataset d2 = new SlidingCategoryDataset(u2, 0, 5); assertEquals(d1, d2); d1.setFirstCategoryIndex(1); assertFalse(d1.equals(d2)); d2.setFirstCategoryIndex(1); assertEquals(d1, d2); d1.setMaximumCategoryCount(99); assertFalse(d1.equals(d2)); d2.setMaximumCategoryCount(99); assertEquals(d1, d2); u1.addValue(3.0, "R1", "C3"); assertFalse(d1.equals(d2)); u2.addValue(3.0, "R1", "C3"); assertEquals(d1, d2); }