Class ListFeatureCollection

  • All Implemented Interfaces:
    Iterable<SimpleFeature>, Collection<SimpleFeature>, SimpleFeatureCollection, FeatureCollection<SimpleFeatureType,​SimpleFeature>

    public class ListFeatureCollection
    extends AbstractFeatureCollection
    implements Collection<SimpleFeature>
    FeatureCollection implementation wrapping around a java.util.List.

    This implementation wraps around a java.util.List and is suitable for quickly getting something on screen.

    Usage notes:

    • This implementation does not use a spatial index, please do not expect spatial operations to be fast.
    • FeatureCollections are not allowed to have duplicates

    This implementation is intended to quickly wrap up a list of features and get them on screen; as such it respects various hints about the copying of internal content as provided by the renderer.

    Author:
    Oliver Gottwald, Jody
    See Also:
    Hints#FEATURE_DETACHED
    • Constructor Detail

      • ListFeatureCollection

        public ListFeatureCollection​(SimpleFeatureType schema)
        Create a ListFeatureCollection for the provided schema An ArrayList is used internally.
      • ListFeatureCollection

        public ListFeatureCollection​(SimpleFeatureType schema,
                                     List<SimpleFeature> list)
        Create a ListFeatureCollection around the provided list. The contents of the list should all be of the provided schema for this to make sense. Please keep in mind the feature collection constraints, no two Features in the list should have the same feature id, and you should not insert the same feature more then once.

        The provided list is directly used for storage, most feature collection operations just use a simple iterator so there is no performance advantaged to be gained over using an ArrayList vs a LinkedList (other then for the size() method of course).

      • ListFeatureCollection

        public ListFeatureCollection​(SimpleFeatureType schema,
                                     SimpleFeature... array)
        Create a ListFeatureCollection around the provided array. The contents of the array should all be of the provided schema for this to make sense. Please keep in mind the feature collection constraints, no two Features in the list should have the same feature id, and you should not insert the same feature more then once.

        The provided array is directly used with a CopyOnWriteArrayList for storage.

      • ListFeatureCollection

        public ListFeatureCollection​(SimpleFeatureCollection copy)
                              throws IOException
        Create a ListFeatureCollection around the provided list. The contents of the list should all be of the provided schema for this to make sense. Please keep in mind the feature collection control, no two Features in the list should have the same feature id, and you should not insert the same feature more then once.

        The provided list is directly used for storage, most feature collection operations just use a simple iterator so there is no performance advantaged to be gained over using an ArrayList vs a LinkedList (other then for the size() method of course).

        Throws:
        IOException