question: protected static Collection < OFMessage > pruneInvalidMessages ( Iterable < OFMessage > msgList , Collection < OFMessage > valid , OFVersion swVersion , boolean isActive ) { if ( isActive ) { valid . addAll ( IterableUtils . toCollection ( msgList ) ) ; return Collections . emptyList ( ) ; } else { Set < OFType > invalidSlaveMsgs = invalidSlaveMsgsByOFVersion . get ( swVersion ) ; List < OFMessage > invalid = new ArrayList < OFMessage > ( ) ; Iterator < OFMessage > itr = msgList . iterator ( ) ; while ( itr . hasNext ( ) ) { OFMessage m = itr . next ( ) ; if ( invalidSlaveMsgs . contains ( m . getType ( ) ) ) { invalid . add ( m ) ; } else { valid . add ( m ) ; } } return invalid ; } }
target:  Sorts any invalid messages by moving them from the msgList. The net result is a new list returned containing the invalid messages and a pruned msgList containing only those messages that are valid for the given role of the controller and OpenFlow version of the switch.