public static String collapseSequenceOfDots(@NotNull String word){
  return word.replaceAll("[.]+",".");
}

public static String collapseSequenceOfDots ( @ NotNull String word ) { return word . replaceAll ( "[.]+" , "." ) ; }
replace sequence of dots with single dot .
