ShapeInMemLayer extends FeatureSourceRetriever implements VectorLayer { public Iterator<?> getElements(Filter filter, int offset, int maxResultSize) throws LayerException { List<SimpleFeature> filteredList = new ArrayList<SimpleFeature>(); for (SimpleFeature feature : features.values()) { if (filter.evaluate(feature)) { filteredList.add(feature); if (filteredList.size() == maxResultSize) { break; } } } return filteredList.iterator(); }  @Override String getId(); void setId(String id); @Override CoordinateReferenceSystem getCrs(); @Api void setLayerInfo(VectorLayerInfo layerInfo); @Override VectorLayerInfo getLayerInfo(); @Override boolean isCreateCapable(); @Override boolean isUpdateCapable(); @Override boolean isDeleteCapable(); @Api void setUrl(String url); Iterator<?> getElements(Filter filter, int offset, int maxResultSize); @Override Envelope getBounds(); Envelope getBounds(Filter filter); @Override FeatureModel getFeatureModel(); @Override Object create(Object feature); @Override Object read(String featureId); @Override Object saveOrUpdate(Object feature); @Override void delete(String featureId);  }
@Test public void getElements() throws LayerException { Iterator<?> it = layer.getElements(filter, 0, 0); int counter = 0; while (it.hasNext()) { it.next(); counter++; } Assert.assertEquals(198, counter); }