I get an error when I use the map function immediately after converting the type with scala, but I don't understand the cause.
// error val list = List (1,2,3,4,2) .toSet.map (n =>n + 1) println (list) // OK val list = List (1,2,3,4,2) val set = list.toSet println (set.map (n =>n + 1)
Works well with Seq
What is the theory behind this difference?
// OK val seq = List (1,2,3,4,2) .toSeq.map (n =>n + 1) println (seq)
Answer # 1
It seems to be explained here
- ruby - is it possible to sort only specific data with the order method?
- c# - is it possible to execute the same name method of multiple classes?
- [java] why is it possible to write the iterator's next method in the conditional expression of the while statement?
- this is a jquery question in the repeated method, it is possible to output to the console, but html cannot be rewritten
- python - you may need to restart the kernel to use updated packages error
- php - coincheck api authentication doesn't work
- php - i would like to introduce the coincheck api so that i can make payments with bitcoin on my ec site
- [php] i want to get account information using coincheck api
- the emulator process for avd pixel_2_api_29 was killed occurred when the android studio emulator was started, so i would like to
- python 3x - typeerror: 'method' object is not subscriptable
- i want to call a child component method from a parent in vuejs
- dart - flutter: the instance member'stars' can't be accessed in an initializer error
- xcode - pod install [!] no `podfile 'found in the project directory