I have created loop on ListBuffer:
val listOfNamesOfMissingFiles = new ListBuffer[String]()
controlFileContent.entries.foreach { entry =>
val fileName = entry("File_Name")
val sha256 = entry("File_SHA_256")
val file = new File(folder, fileName)
if (!file.exists()) {
logger.error(s"Control file validation failed: file does not exist in folder: [$fileName].")
listOfNamesOfMissingFiles += fileName
}
I want to assign what i am getting in listOfNamesOfMissingFiles to one string to an attribut which i am sending it as event to kibana portal. If my listOfNamesOfMissingFiles == ListBuffer("hhhh","uuuu"). if i will do listOfNamesOfMissingFiles.toString I will get "ListBuffer("hhhh","uuuu")". how can i remove the ListBuffer from the output?
I think what you're trying to achieve is just joining a list of strings. Scala provides the
mkStringmethod: