Kotlin 標準クラス・メソッド一覧
1. 基本型(プリミティブ・文字列)- String → length, substring(start,end), contains("abc"), replace(old,new), split(delimiter)
- Char → isDigit(), isLetter(), uppercaseChar(), lowercaseChar()
- Int / Long / Short / Byte → toString(), toDouble()/toFloat(), coerceIn(min,max)
- Float / Double → toInt(), isNaN(), isInfinite()
- Boolean → not()
- List / MutableList → size, get(index), add(element)/remove(element), map{ }, filter{ }, forEach{ }
- Set / MutableSet → contains(element), add(element)/remove(element)
- Map / MutableMap → keys, values, get(key), put(key,value)/remove(key)/li>
- Array → size, get(index)/set(index,value), arrayOf(...)
- Sequence → map{ }, filter{ }, toList()
- Iterable → forEach{ }
3. ペア・範囲
- Pair / Triple → first/second/third, toList()
- Range / ClosedRange → contains(value), start, endInclusive
4. 正規表現
- Regex → matches(str), containsMatchIn(str), find(str), replace(str,replacement)
5. エラー・例外
- Throwable / Exception → message, printStackTrace()
- Result → isSuccess/isFailure, getOrNull(), exceptionOrNull()
6. 比較・列挙
- Comparator → compare(a,b), then
- Enum → values(), name, ordinal
7. アノテーション・特殊型
- Annotation → annotationClass
- Nothing → 戻らない処理専用(メソッドなし)