private static void getLinealGeometry(ArrayList<LineString> lines, Geometry geometry) {
         for (int i = 0; i < geometry.getNumGeometries(); i++) {
            Geometry subGeom = geometry.getGeometryN(i);
            if(subGeom instanceof LineString){
                lines.add((LineString) subGeom);
            }
            else if (subGeom instanceof GeometryCollection){
                getLinealGeometry(lines, subGeom);
            }
        }
    }
private static void getLinealGeometry ( ArrayList < LineString > lines , Geometry geometry ) { for ( int i = 0 ; i < geometry . getNumGeometries ( ) ; i ++ ) { Geometry subGeom = geometry . getGeometryN ( i ) ; if ( subGeom instanceof LineString ) { lines . add ( ( LineString ) subGeom ) ; } else if ( subGeom instanceof GeometryCollection ) { getLinealGeometry ( lines , subGeom ) ; } } }
Filter line from a geometry
@param lines
@param geometry