In Kotlin this is the design for accepting input from the user, could someone , line by line, explain what this means ?
readLine()!!.split(β ') .map(String::toInt)
In Kotlin this is the design for accepting input from the user, could someone , line by line, explain what this means ?
readLine()!!.split(β ') .map(String::toInt)
There are three function invocations here:
readLine
function reads a line from the standard input;!!
to assert that the value is not null;split
function invoked on the result of readLine
splits the line to a list of strings, using space character as a separator;map
function takes each element of that list, transforms it with the specified function β String::toInt
is a reference to the function String.toInt()
β and places the results of transformation to a new list of ints.