Scala: Nil vs List()

scala> println (Nil == List()) true scala> println (Nil eq List()) true scala> println (Nil equals List()) true scala> System.identityHashCode(Nil) 374527572 scala> System.identityHashCode(List()) 374527572 Nil is more idiomatic and can be preferred in most cases. Questions?

Stream vs Views vs Iterators

First, they are all non-strict. That has a particular mathematical meaning related to functions, but, basically, means they are computed on-demand instead of in advance. Stream is a lazy list indeed. In fact, in Scala, a Stream is a List whose tail is a lazy val. Once computed, a value stays computed and is reused. … Read more

Debugging Scala code with simple-build-tool (sbt) and IntelliJ

There’s a very convenient -jvm-debug flag in the official SBT packages for Mac, Linux & Windows. You can use the flag to specify the debug port: sbt -jvm-debug 5005 Under the covers, this starts the JVM for SBT with the typical verbose debugging incantation: -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005 You now can run your code as normal, for … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)