Q:

found String, Required (String,String,String,Int): tuples-scala

I am having 3 ListBuffers of equal lengths.

devicenamelist:ListBuffer[String]
datelist:ListBuffer[String]
wordcountssortedlistbuf[(String,Int)]

Now I need to convert them of the format

ListBuffer(String,String,String,Int)

I tried to do the following
 var sortedrecords=scala.collection.mutable.ListBuffer[(String,String,String,Int)]()

 for(i <- 0 to devicenamelist.length)
{

sortedrecords+=(devicenamelist(i),datelist(i),wordcountssortedlistbuf(i)._1,wordcountssortedlistbuf(i)._2)  

}

It gives me error as follows

[error] found String
Required (String,String,String,Int)

How is the list appending operation at the top giving only a single string when my intention was to create (String,String,String,Int). Am I missing something?
Thanks

A:

You are missing a set of parentheses in your += line, but, please, don't do that, it hurts my eyes to see someone write something like this in scala. 
Try something like this instead: 
val sortedrecords = devicenamelist.zip(datelist).zip(wordcountssortedlistbuf)
 .map { case ((devicename, date), (word, count)) => 
   (devicename, date, word, count)
 }

