public MessageBatch replace ( Message existing_msg , Message new_msg ) { if ( existing_msg == null ) return this ; for ( int i = 0 ; i < index ; i ++ ) { if ( messages [ i ] != null && messages [ i ] == existing_msg ) { messages [ i ] = new_msg ; break ; } } return this ; }
Replaces a message in the batch with another one