2013-04-30

Scala Collection method 適当なまとめ

最終更新が2年くらい前かよ… 気にせず書きます。

今更
http://www.scala-lang.org/docu/files/collections-api/collections.html
(の日本語訳)を読んでいるんですが、会社で使ってる Scala のバージョンが 2.8.2 だからいいよねって事で
半年くらい前まで 2.7.7 使ってたんですよ…酷い
単純に読み辛いからみやすくしただけです。Travarsable のところ。

Addition

  • ++

Map operations

  • map
  • flatMap
  • collect (map + flatMap)

Conversions

  • toArray
  • toList
  • toIterable
  • toSeq
  • toIndexedSeq (Vector 等 IndexedSeq に変換)
  • toStream
  • toSet
  • toMap

Copying operations

  • copyToBuffer
  • copyToArray

Size info operations

  • isEmpty
  • nonEmpty
  • size
  • hasDefiniteSize

Element retrieval operations

  • head
  • last
  • headOption
  • lastOption
  • find

Sub-collection retrieval operations

  • tail
  • init
  • slice
  • take
  • drop
  • takeWhile
  • dropWhile
  • filter
  • filterNot
  • withFilter

Subdivision operations

  • splitAt
  • span
  • partition
  • groupBy

Element tests

  • exists
  • forall
  • count

Folds

  • foldLeft
  • foldRight
  • /:
  • :\
  • reduceLeft
  • reduceRight

Specific folds

  • sum
  • product
  • min
  • max

String operations

  • mkString
  • addString
  • stringPrefix

View operations


うおー min,max はいつも math 使ってたアホす…