private void insertInOrder(Vector list,MqttWireMessage newMsg){
  int newMsgId=newMsg.getMessageId();
  for (int i=0; i < list.size(); i++) {
    MqttWireMessage otherMsg=(MqttWireMessage)list.elementAt(i);
    int otherMsgId=otherMsg.getMessageId();
    if (otherMsgId > newMsgId) {
      list.insertElementAt(newMsg,i);
      return;
    }
  }
  list.addElement(newMsg);
}

private void insertInOrder ( Vector list , MqttWireMessage newMsg ) { int newMsgId = newMsg . getMessageId ( ) ; for ( int i = 0 ; i < list . size ( ) ; i ++ ) { MqttWireMessage otherMsg = ( MqttWireMessage ) list . elementAt ( i ) ; int otherMsgId = otherMsg . getMessageId ( ) ; if ( otherMsgId > newMsgId ) { list . insertElementAt ( newMsg , i ) ; return ; } } list . addElement ( newMsg ) ; }
inserts a new message to the list , ensuring that list is ordered from lowest to highest in terms of the message id ' s .
