public static Multimap < String , PathOperation > groupOperationsByTag ( List < PathOperation > allOperations , Comparator < PathOperation > operationOrdering ) { Multimap < String , PathOperation > operationsGroupedByTag ; if ( operationOrdering == null ) { operationsGroupedByTag = LinkedHashMultimap . create ( ) ; } else { operationsGroupedByTag = MultimapBuilder . linkedHashKeys ( ) . treeSetValues ( operationOrdering ) . build ( ) ; } for ( PathOperation operation : allOperations ) { List < String > tags = operation . getOperation ( ) . getTags ( ) ; Validate . notEmpty ( tags , "Can't GroupBy.TAGS. Operation '%s' has no tags" , operation ) ; for ( String tag : tags ) { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Added path operation '{}' to tag '{}'" , operation , tag ) ; } operationsGroupedByTag . put ( tag , operation ) ; } } return operationsGroupedByTag ; }
Groups the operations by tag . The key of the Multimap is the tag name . The value of the Multimap is a PathOperation