Using VI Java from ScalaDave “Bric” Briccetti, Contractor at VMware          Dave Briccetti Software LLC                da...
VI Java for Performance Graphs
HelloVM.scala
Quick Intro to Scala                  (Enough to read the code)●   val and var●   List●   Array●   map●   Singleton object...
val and var●   val creates a final variable    val x = 1    x=2    error: reassignment to val    var x = 1    x=2
List●   val nums = List(2,5,8)    nums: List[Int] = List(2, 5, 8)    nums.size    res9: Int = 3
Array●   val nums = Array(1,5,7)    nums: Array[Int] = Array(1, 5, 7)    nums.toList    res8: List[Int] = List(1, 5, 7)
map●   val nums = List(2,5,8)    nums: List[Int] = List(2, 5, 8)    nums.map(_ + 1)    res10: List[Int] = List(3, 6, 9)
Singleton Object●   Java types:    ●   class    ●   interface●   Scala types:    ●   class    ●   trait    ●   object●   o...
match●   List(2) match {        case first :: rest => "First: " + first + ", rest: " + rest        case _ => "no match"   ...
Unit Test
HelloVM Part 1
HelloVM Part 2
HelloVM Part 3
Summary●   The Java Virtual Machine runs many    languages, including Scala●   VI Java can be used by any of these languag...
Upcoming SlideShare
Loading in …5
×

Using VI Java from Scala

968 views

Published on

Slides to accompany short talk http://www.doublecloud.org/2011/04/mark-your-calendar-for-our-first-community-event/

Published in: Technology, News & Politics
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
968
On SlideShare
0
From Embeds
0
Number of Embeds
6
Actions
Shares
0
Downloads
3
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Using VI Java from Scala

  1. 1. Using VI Java from ScalaDave “Bric” Briccetti, Contractor at VMware Dave Briccetti Software LLC davebsoft.com @dcbriccetti
  2. 2. VI Java for Performance Graphs
  3. 3. HelloVM.scala
  4. 4. Quick Intro to Scala (Enough to read the code)● val and var● List● Array● map● Singleton object● match
  5. 5. val and var● val creates a final variable val x = 1 x=2 error: reassignment to val var x = 1 x=2
  6. 6. List● val nums = List(2,5,8) nums: List[Int] = List(2, 5, 8) nums.size res9: Int = 3
  7. 7. Array● val nums = Array(1,5,7) nums: Array[Int] = Array(1, 5, 7) nums.toList res8: List[Int] = List(1, 5, 7)
  8. 8. map● val nums = List(2,5,8) nums: List[Int] = List(2, 5, 8) nums.map(_ + 1) res10: List[Int] = List(3, 6, 9)
  9. 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. 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)
  11. 11. Unit Test
  12. 12. HelloVM Part 1
  13. 13. HelloVM Part 2
  14. 14. HelloVM Part 3
  15. 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

×