What it is not so good for?

In languages other than Scala, some special care needs to be taken when lazy initialization is used in a multithreaded setting. In Java, for example, you need to do initialization in a synchronized block. In order to provide even better safety, double-checked locking is preferred. There is no such danger in Scala.

Get Scala Design Patterns - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.