Help us understand the problem. What is going on with this article?

Kotlin to Scala cheat sheet

More than 1 year has passed since last update.

Kotlinをやったことがあって、Scalaをやったことがない人向けのシンタックスチートシート。
細かい動作の違いや仕様の違いは書いてません。

概念 Kotlin Scala
top level function object
companion object companion object object
Value Object data class case class
関数 fun def
forでの初期代入 in <-
range 0..10 0 to 10
forでの値飛ばし step, downTo by
パターンマッチ when ~ is match ~ case
インスタンス生成 Foo() new Foo
コンストラクタ constructor def this
インターフェース interface trait
ジェネリクス <T> [T]
変性 out, in +, -
lamda -> =>
nullable String? Option[String]
build tool gradle sbt(Scala Build Tool)
スコープ関数 with, apply, let, run, also 対応なし
拡張関数 fun クラス名.関数名() pimp my library
暗黙的な型変換など 対応なし implicit
関数の空実装 TODO() ???
formatter ktlint Scalafmt, Scalareform

Scalaでしかできないもので勉強した方がよさそうなこと

  • implicit
  • Pattern Match
  • モナド
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした