private static List < String > parseAndCompare ( List < String > fileNames , int masterPartitionId ) { List < String > sourceFileNames = new ArrayList < String > ( ) ; for ( String fileName : fileNames ) { String [ ] partitionIdReplicaChunk = fileName . split ( SPLIT_LITERAL ) ; if ( Integer . parseInt ( partitionIdReplicaChunk [ 0 ] ) == masterPartitionId ) { sourceFileNames . add ( fileName ) ; } } return sourceFileNames ; }
This method take a list of fileName of the type partitionId_Replica_Chunk and returns file names that match the regular expression masterPartitionId_