### Question:
TimeSeriesCollection extends AbstractIntervalXYDataset implements XYDataset, IntervalXYDataset, DomainInfo, XYDomainInfo,
        XYRangeInfo, VetoableChangeListener, Serializable { public int indexOf(TimeSeries series) { ParamChecks.nullNotPermitted(series, "series"); return this.data.indexOf(series); } TimeSeriesCollection();  TimeSeriesCollection(TimeZone zone);  TimeSeriesCollection(TimeSeries series);  TimeSeriesCollection(TimeSeries series, TimeZone zone); @Override DomainOrder getDomainOrder(); TimePeriodAnchor getXPosition(); void setXPosition(TimePeriodAnchor anchor); List<TimeSeries> getSeries(); @Override int getSeriesCount(); int indexOf(TimeSeries series); TimeSeries getSeries(int series); TimeSeries getSeries(Comparable key); @Override Comparable getSeriesKey(int series); int getSeriesIndex(Comparable key); void addSeries(TimeSeries series); void removeSeries(TimeSeries series); void removeSeries(int index); void removeAllSeries(); @Override int getItemCount(int series); @Override double getXValue(int series, int item); @Override Number getX(int series, int item); @Override synchronized Number getStartX(int series, int item); @Override synchronized Number getEndX(int series, int item); @Override Number getY(int series, int item); @Override Number getStartY(int series, int item); @Override Number getEndY(int series, int item); int[] getSurroundingItems(int series, long milliseconds); @Override double getDomainLowerBound(boolean includeInterval); @Override double getDomainUpperBound(boolean includeInterval); @Override Range getDomainBounds(boolean includeInterval); @Override Range getDomainBounds(List<Comparable> visibleSeriesKeys,
            boolean includeInterval); Range getRangeBounds(boolean includeInterval); @Override Range getRangeBounds(List<Comparable> visibleSeriesKeys, 
            Range xRange, boolean includeInterval); @Override void vetoableChange(PropertyChangeEvent e); @Override boolean equals(Object obj); @Override int hashCode(); @Override Object clone();  }### Answer:
@Test public void testIndexOf() { TimeSeries s1 = new TimeSeries("S1"); TimeSeries s2 = new TimeSeries("S2"); TimeSeriesCollection dataset = new TimeSeriesCollection(); assertEquals(-1, dataset.indexOf(s1)); assertEquals(-1, dataset.indexOf(s2)); dataset.addSeries(s1); assertEquals(0, dataset.indexOf(s1)); assertEquals(-1, dataset.indexOf(s2)); dataset.addSeries(s2); assertEquals(0, dataset.indexOf(s1)); assertEquals(1, dataset.indexOf(s2)); dataset.removeSeries(s1); assertEquals(-1, dataset.indexOf(s1)); assertEquals(0, dataset.indexOf(s2)); TimeSeries s2b = new TimeSeries("S2"); assertEquals(0, dataset.indexOf(s2b)); }