code: public SimpleFeatureCollection toFeatureCollection() {
          checkTinGeometries();
          SimpleFeatureTypeBuilder b = new SimpleFeatureTypeBuilder();
          b.setName("triangle");
          b.setCRS(crs);
  
          DefaultFeatureCollection newCollection = new DefaultFeatureCollection();
          b.add("the_geom", Polygon.class);
          b.add("elev0", Double.class);
          b.add("elev1", Double.class);
          b.add("elev2", Double.class);
          SimpleFeatureType type = b.buildFeatureType();
          SimpleFeatureBuilder builder = new SimpleFeatureBuilder(type);
          for( Geometry g : tinGeometries ) {
              Coordinate[] coordinates = g.getCoordinates();
  
              Object[] values;
              int windingRule = GeometryUtilities.getTriangleWindingRule(coordinates[0], coordinates[1], coordinates[2]);
              if (windingRule > 0) {
                  // need to reverse the triangle
                  values = new Object[]{g, coordinates[0].z, coordinates[2].z, coordinates[1].z};
              } else {
                  values = new Object[]{g, coordinates[0].z, coordinates[1].z, coordinates[2].z};
              }
  
              builder.addAll(values);
              SimpleFeature feature = builder.buildFeature(null);
              newCollection.add(feature);
          }
          return newCollection;
      }
docs: Create a {@link SimpleFeatureCollection FeatureCollection} from the current tin triangles
  with information about the vertexes elevation.
  
  @return the feature collection of the tin.