code: private static void decompose(Geometry geometry, Collection<Geometry> list) {
          for (int i = 0; i < geometry.getNumGeometries(); i++) {
              Geometry component = geometry.getGeometryN(i);
              if (component instanceof GeometryCollection) {
                  decompose(component, list);
              } else {
                  list.add(component);
              }
          }
      }
docs: Decompose a geometry recursively into simple components.
  
  @param geometry input geometry
  @param list a list of simple components (Point, LineString or Polygon)