question: private void updateTypes ( @ Nonnull TurnoutOperation op ) { if ( ! initialized ) initialize ( ) ; LinkedList < TurnoutOperation > newTypes = new LinkedList < TurnoutOperation > ( ) ; Iterator < TurnoutOperation > iter = operationTypes . iterator ( ) ; boolean found = false ; while ( iter . hasNext ( ) ) { TurnoutOperation item = iter . next ( ) ; if ( item . getClass ( ) == op . getClass ( ) ) { newTypes . add ( op ) ; found = true ; log . debug ( "replacing definitive instance of " + item . getClass ( ) ) ; } else { newTypes . add ( item ) ; } } if ( ! found ) { newTypes . add ( op ) ; log . debug ( "adding definitive instance of " + op . getClass ( ) ) ; } operationTypes = newTypes ; }
target:  update the list of types to include a new or updated definitive instance. since order is important we retain the existing order, placing a new type at the end if necessary