Slide 1Slide 2Slide 3Slide 4Slide 5Slide 6Slide 7Slide 8Slide 9Other Collections9-9-2011Opening DiscussionMinute essay comments:Can we make type parameters be abstract types?Comparing Java and Scala type parameters.Type parameters can be put on classes. We'll see examples of that in a few weeks.Parametric vs. inclusionFinishing SortsIdeally I'd like to put these into commands in the drawing program. I don't know if we can get that far.Do sort with comparison function first.scala.collectionhttp://www.scala-lang.org/docu/files/collections-api/collections_1.htmlThe collection API in Scala is really powerful. This is a big part of what makes the language so great to use.In the first semester we focus on basic sequence types.We gain a lot of power by adding Map, Set, and Buffer.MapStores (key, value) pairs. Let's you do fast look-up by key.Two type parameters.A sequence is indexed by Int and need “all slots filled”.A Map can be indexed by anything and can be sparse.You should only use immutable values for keys.SetBased on math idea.Order doesn't matter.Elements have to be unique.BufferLike an array with the ability to grow and shrink.Drawing ProgramLet's add more code do the drawing program.The command processor is a great example of a place where a Map can come in handy.Minute EssayQuestions?How do you see various collections being used in your
View Full Document