Scala Tutorialsを読む 26 Mutable Collections

http://scalatutorials.com/tour/interactive_tour_of_scala_mutable_collections.html

26 Mutable Collections

  • Scala "encourages" using immutable collections (hence they are those used by default) however sometimes mutable collections might have some benefits, either for CPU / memory performance, for code readability or simply a matter of preference.
  • Scala はimmutableコレクションを使う事を"奨励しています"。(ゆえに、デフォルトでそれらをつかようになっている) しかしながらCPU/メモリパフォーマンス、コードの読みやすさもしくは単純に好みで、時にはmutableなコレクションを使った方がいい場合もあるでしょう。
  • As we saw earlier, Scala provides concrete mutable collections in scala.collections.mutable
  • 我々は先に見たように、Scalaは、具体的な変更可能なコレクションをscala.collections.mutableで提供しています。
  • Best practice suggests that you prefix mutable collections with mutable, this might not seem useful for ArrayBuffer, but it will for scala.collections.mutable.Map
  • ベストプラクティスはmutableなコレクションのプリフィックスをmutableのために使う事で、これはArrayBufferより役立つとは思わないかもしれませんが、scala.collections.mutable.Mapを使う事です。
  • ArrayBuffer is the more or less equivalent to java's java.util.ArrayList which is backed by an array
  • ArrayBufferは配列を背後に持つjava.util.ArrayListよりよかったり悪かったりします。
  • ListBuffer is the mutable partner for scala's immutable List, implemented as a Linked List
  • ListBufferはmutableなscalaのimmutable Listのパートナーで、リンクドリストで実装されています。
  • There are many other mutable collections types, see links below for more information
  • 他にも沢山のmutableコレクションタイプがありますので、以下のリンクの情報を見てください

See Also opens in new page

新しいページを開いて参照

  • Concrete Mutable Collection Classes
  • 具象Mutableコレクションクラス
  • What is scala's equivalent of java.util.ArrayList in stackoverflow
  • スタックオーバーフローでの何がjava.util.ArrayListscala環境か。
  • scala.collections.mutable package docs
  • scala.collections.mutable パッケージドキュメント