public static void main(String args[]){
        Node head1 = null;
      
      LinkList ll = new LinkList();
      head1 = ll.addNode(1, head1, new Point(0,10));
      head1 = ll.addNode(2, head1, new Point(1,10));
      head1 = ll.addNode(3, head1, new Point(5,10));
      head1 = ll.addNode(4, head1, new Point(7,10));
      head1 = ll.addNode(5, head1, new Point(7,5));
      head1 = ll.addNode(6, head1, new Point(20,5));
      head1 = ll.addNode(7, head1, new Point(40,5));
      head1 = ll.addNode(8, head1, new Point(40,8));
           
      RemoveMiddleElementsOfLineSegment rme = new RemoveMiddleElementsOfLineSegment();
      rme.remove(head1);
      ll.printList(head1);
    }
http://www.geeksforgeeks.org/given-linked-list-line-segments-remove-middle-points/
@author tusroy
Test cases:
0 or more nodes
All points are edge of line segments so nothing gets removed
One long line so all points in between get removed
src/com/interview/linklist/RemoveMiddleElementsOfLineSegment.java