public void checkSorting(MyIdxList list) throws Exception {
  Iterator<ListNode> en=m_List.iterator();
  ListNode first=null, second=null;
  while (en.hasNext()) {
    if (first == null) {
      first=en.next();
    }
 else {
      second=en.next();
      if (first.distance < second.distance) {
        throw new Exception("List not sorted correctly." + " first.distance: " + first.distance + " second.distance: "+ second.distance+ " Please check code.");
      }
    }
  }
}

public void checkSorting ( MyIdxList list ) throws Exception { Iterator < ListNode > en = m_List . iterator ( ) ; ListNode first = null , second = null ; while ( en . hasNext ( ) ) { if ( first == null ) { first = en . next ( ) ; } else { second = en . next ( ) ; if ( first . distance < second . distance ) { throw new Exception ( "List not sorted correctly." + " first.distance: " + first . distance + " second.distance: " + second . distance + " Please check code." ) ; } } } }
checks the sorting of a list .
