Rewrite Java in Scala - Guava vs. Scala
The latest Java Posse takes three Googlers talking about Guava. Curiously, I wonder how Guava compares to currently popular Scala. From someone's comments in Stack Overflow insight that why Guava's can't match Scala's overall solution, based on just trying to solve Collections issue.
Google Guava is a fantastic library, there's no doubt about it. However, it's implemented in Java and suffers from all the restrictions that that implies:
• No immutable collection interface in the standard library
• No lambda literals (closures), so there's some heavy boilerplate around the SAM types needed for e.g. predicates
• lots of duplication in type specifications, especially where generics are involved
Guava also has to exist in the presence of Java's standard collection library, so it's rare that 3rd party libraries will expose guava-compatible function literals or make use of guava-specific collection types. This causes an impedance mismatch for every third party library that you use. For example, you'll typically want to convert returned collections from such libraries to the appropriate guava immutable collection - especially if working in a multi-threaded environment.
Scala collections have a design that is far better integrated into the language, you'll find them widely used throughout the Scala standard library and through 3rd party products implemented in Scala. Scala collections are also immutable by default, so you end up with far safer code that doesn't require an extra layer of defensive wrapping.
Read more: http://stackoverflow.com/questions/6598498/google-guava-vs-scala-collection-framework-comparison