private String inverseRename(String renamedFilename,Map<String,String> renamedToReferenceMap){
  List<String> renamedAllParts=FILE_SEP_SPLITTER.splitToList(renamedFilename);
  for (int i=renamedAllParts.size(); i > 0; i--) {
    String renamedParts=FILE_SEP_JOINER.join(renamedAllParts.subList(0,i));
    String partsToSubstitute=renamedToReferenceMap.get(renamedParts);
    if (partsToSubstitute != null) {
      return renamedFilename.replace(renamedParts,partsToSubstitute);
    }
  }
  return renamedFilename;
}

private String inverseRename ( String renamedFilename , Map < String , String > renamedToReferenceMap ) { List < String > renamedAllParts = FILE_SEP_SPLITTER . splitToList ( renamedFilename ) ; for ( int i = renamedAllParts . size ( ) ; i > 0 ; i -- ) { String renamedParts = FILE_SEP_JOINER . join ( renamedAllParts . subList ( 0 , i ) ) ; String partsToSubstitute = renamedToReferenceMap . get ( renamedParts ) ; if ( partsToSubstitute != null ) { return renamedFilename . replace ( renamedParts , partsToSubstitute ) ; } } return renamedFilename ; }
walks backwards through the dir prefixes of renamedfilename looking for a match in renamedtoreferencemap .
