Материалы

Презентация: CollectionsInScala.pptx

Примеры и задание: lession9.zip

Задание

В класса org.mai.dep110.scala.iris.IrisExample с помощью методов scala.collection.immutable.List рассчитать

//get average sepal width
val avgSetalLength = 0.0
println(avgSetalLength)

//get average petal square - petal width multiplied on petal length
val avgPetalLength = 0.0
println(avgPetalLength)

//get average petal square for flowers with sepal width > 4
val avgPetalSquare = 0.0
println(avgPetalSquare)

//get flowers grouped by Petal size (PetalSize.Small, etc.) with function getPetalSize
val groupsByPetalSize = Map()
println(groupsByPetalSize)

//get max sepal width for flowers grouped by species
val maxSepalWidthForGroupsBySpecies = Map()
println(maxSepalWidthForGroupsBySpecies)



Документация

Scala lang: https://docs.scala-lang.org/overviews/collections/overview.html

Диаграммы

  1. scala.collection


  2. scala.collection.immutable


  3. scala.collection.mutable
  • Нет меток