1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Kotlin コード集

Last updated at Posted at 2018-04-07

コード集

自分で Kotlin を書いてて気づいたことをメモ程度に書き込んでおくための記事
間違えている部分がありましたらコメントでの指摘をよろしくお願いします。

for() と .map{}

val inputList = mutableListOf<Int>()
for (i in 0..1) {
    inputList.add(readLine()!!.toInt())
}
val inputList = (0..1).map { readLine()!!.toInt() }

上二つは同じこと。2つ目の方が変数定義・代入をいっぺんにできるので便利。

重複なし組み合わせ

1
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?