While still waiting for approval to the CCA 175 certification forum, I am posting this question here in Scala:
Following the instructor’s lecture, I have the following script:
val orderItemsList = Source.fromFile(“C://RXIE//Learning//Scala//data//retail_db//orders//part-00000”).getLines.toList
This works, and:
orderItemsList.size gives 68883 which is correct.
In the list data is like:
I want to apply a filter like:
val order123 = orderItemsList.map(orderItem => orderItem.split(",")(2).toInt < 123).size
val order12345 = orderItemsList.map(orderItem => orderItem.split(",")(2).toInt > 12345).size
both return 68883, meaning the filters are not working.
Can someone enlighten me why the filters are not working?
Thank you very much.
Updated: sorry I was confused at the beginning, it should be “filter”, not “map”