Tuple referening elements



Hi Freinds,

My question may be easy but please don’t mind for asking this.

I am referring Spark exercises with Scala.

In first crime data excercise there is a statment like map(rec => ((rec._1._1, -rec._2), rec._1._1 + “\t” + rec._2 + “\t” + rec._1._2))
I am not getting what’s the difference between (rec._1._1, -rec._2) and (rec._1._1, rec._2) .What’ the advantage with that “-” .



-” indicates negation, in this case, we need the data to be in the descending order by count, so we used -rec._2. I hope that clarified your query


Thanks Sunil. Yes it clarifies my query but unfortunately not found this information in google.