public static String formatCoGbkResults ( String name , Iterable < String > emails , Iterable < String > phones ) { List < String > emailsList = new ArrayList <> ( ) ; for ( String elem : emails ) { emailsList . add ( "'" + elem + "'" ) ; } Collections . sort ( emailsList ) ; String emailsStr = "[" + String . join ( ", " , emailsList ) + "]" ; List < String > phonesList = new ArrayList <> ( ) ; for ( String elem : phones ) { phonesList . add ( "'" + elem + "'" ) ; } Collections . sort ( phonesList ) ; String phonesStr = "[" + String . join ( ", " , phonesList ) + "]" ; return name + "; " + emailsStr + "; " + phonesStr ; }
Helper function to format results in coGroupByKeyTuple .