Unformatted text preview:

Slide 1Slide 2Slide 3Slide 4Slide 5Slide 6Slide 7Slide 8Slide 9Other Collections9-9-2011Opening DiscussionMinute 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 SortsIdeally 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.collectionhttp://www.scala-lang.org/docu/files/collections-api/collections_1.htmlThe 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.MapStores (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.SetBased on math idea.Order doesn't matter.Elements have to be unique.BufferLike an array with the ability to grow and shrink.Drawing ProgramLet'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 EssayQuestions?How do you see various collections being used in your


View Full Document

TRINITY CSCI 1321 - Lecture Notes

Documents in this Course
Recursion

Recursion

11 pages

Iterators

Iterators

10 pages

Actors

Actors

9 pages

Recursion

Recursion

15 pages

Recursion

Recursion

10 pages

Threads

Threads

7 pages

Trees

Trees

11 pages

Load more
Download Lecture Notes
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Lecture Notes and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lecture Notes 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?