SeriesRegistry implements Serializable { public synchronized List<BundleType> remove(SeriesType series, Class rendererClass) { ArrayList<BundleType> removedItems = new ArrayList<>(); for(Iterator<BundleType> it = registry.iterator(); it.hasNext();) { BundleType b = it.next(); if(b.getSeries() == series && b.getFormatter().getRendererClass() == rendererClass) { it.remove(); removedItems.add(b); } } return removedItems; }  List<BundleType> getSeriesAndFormatterList(); List<SeriesType> getSeriesList(); int size(); boolean isEmpty(); boolean add(SeriesType series, FormatterType formatter); synchronized List<BundleType> remove(SeriesType series, Class rendererClass); synchronized boolean remove(SeriesType series); void clear(); List<SeriesBundle<SeriesType, FormatterType>> getLegendEnabledItems(); boolean contains(SeriesType series, Class<? extends FormatterType> formatterClass);  }
@Test public void testRemove() { Series series = new SimpleXYSeries("s1"); seriesRegistry.add(series, new LineAndPointFormatter()); assertEquals(1, seriesRegistry.size()); seriesRegistry.remove(new SimpleXYSeries("s2")); assertEquals(1, seriesRegistry.size()); seriesRegistry.remove(series); assertEquals(0, seriesRegistry.size()); }