Can't see the real difference between :: and +: method of Scala List.
I used REPL to test and can't see diff from the result.
Anyone can give me how can I use that properly?
Can't see the real difference between :: and +: method of Scala List.
I used REPL to test and can't see diff from the result.
Anyone can give me how can I use that properly?
Looking at the code of List,
+:uses::(cons) operator for prepending.In general,
+:is defined inSeqLikeand any collection implementingSeqLikecan use the same.On the other hand
::is defined inListand can only be used byList.