private List reduceToGeometries(List geomTree){
  List geoms=new ArrayList();
  for (Iterator i=geomTree.iterator(); i.hasNext(); ) {
    Object o=i.next();
    Geometry geom=null;
    if (o instanceof List) {
      geom=unionTree((List)o);
    }
 else     if (o instanceof Geometry) {
      geom=(Geometry)o;
    }
    geoms.add(geom);
  }
  return geoms;
}

private List reduceToGeometries ( List geomTree ) { List geoms = new ArrayList ( ) ; for ( Iterator i = geomTree . iterator ( ) ; i . hasNext ( ) ; ) { Object o = i . next ( ) ; Geometry geom = null ; if ( o instanceof List ) { geom = unionTree ( ( List ) o ) ; } else if ( o instanceof Geometry ) { geom = ( Geometry ) o ; } geoms . add ( geom ) ; } return geoms ; }
reduces a tree of geometries to a list of geometries by recursively unioning the subtrees in the list .
