How to modify a specific vertex of a polyline

A polyline is composed of one or more paths (part) and a path (part) is formed of one or more segments. Each segment has a from point and a to point.

Modifying a specific vertex of a polyline

The following are the steps to modify a vertex of a polyline:
  1. Query interface (QI) the polyline for IHitTest and use the HitTest method (esriGeometryPartVertex option).
  2. QI the polyline for IGeometryCollection.
  3. Use the geometry property with the part index returned by the HitTest to get the path containing the point to modify.
  4. QI the path for IPointCollection.
  5. Use the point property with the vertex (segment) index returned by the HitTest (get a copy of the point).
  6. Modify the point using any methods.
  7. Update the point using UpdatePoint with the vertex index from HitTest.
In the following code example, HitTest of the IHitTest interface is used to locate the indexes of the part and the vertex that needs to be modified. When found, ITransform2D is used to modify the coordinate of the vertex:
static void modifyOneVertexOfAPolyline()throws Exception{
    IGeometryCollection geomColl =
    IPolyline polyine = (IPolyline)geomColl;
    IHitTest hitTest = (IHitTest)geomColl;
    IPoint point = polyine.getFromPoint();
    double dr = 1;
    IPoint pHit = new Point();
    double[] dht = new double[1];
    int[] lPart = new int[1], lVertex = new int[1];
    boolean[] bright = new boolean[1];
    hitTest.hitTest(point, dr, esriGeometryHitPartType.esriGeometryPartVertex, pHit,
        dht, lPart, lVertex, bright);
    IPointCollection pPathColl = (IPointCollection)geomColl.getGeometry(lPart[0]);
    ITransform2D pTrans2D = (ITransform2D)pPathColl.getPoint(lVertex[0]);
    pTrans2D.move( - 10, 0);
    //Notice that the point  is not updated in the Polyline until the next line is called
    pPathColl.updatePoint(lVertex[0], (IPoint)pTrans2D);