Scala Collections Design Pearls

Attached a presentation I gave at a client about some design pearls from the Scala collection library that show some advanced features of Scala:

  • Use of functions for iteration
  • Usage of builders so that filter and map can return the same type as they were invoked in, or one that is applicable
  • Exitential types
  • Type constructors
  • Views and iterators
  • Type classes
  • Manifests
  • Generalized type constraints
  • How strings and native arrays also have all methods of the collection hierarchy
  • Streams