This document introduces using VI Java, a Java performance analysis tool, from Scala. It provides a quick overview of Scala concepts like val and var for variables, Lists, Arrays, mapping functions, singleton objects, and pattern matching using match. These concepts are demonstrated in code examples to visualize VI Java metrics from Scala and show how Scala interoperates well with Java libraries.
9. Singleton Object
● Java types:
● class
● interface
● Scala types:
● class
● trait
● object
● object is like a preinstantiated object of a class,
with all members static
10. match
● List(2) match {
case first :: rest => "First: " + first + ", rest: " + rest
case _ => "no match"
}
res17: java.lang.String = First: 2, rest: List()
● List(2,3) match {
case first :: rest => "First: " + first + ", rest: " + rest
case _ => "no match"
}
res18: java.lang.String = First: 2, rest: List(3)
15. Summary
● The Java Virtual Machine runs many
languages, including Scala
● VI Java can be used by any of these languages
● Scala is a powerful language, which
interoperates very well with Java libraries like VI
Java
Dave Briccetti Software LLC
davebsoft.com
@dcbriccetti