{"id":138452,"date":"2021-04-26T04:56:43","date_gmt":"2021-04-26T03:56:43","guid":{"rendered":"https:\/\/blog.jetbrains.com\/?post_type=kotlin&#038;p=138452"},"modified":"2021-04-26T04:56:43","modified_gmt":"2021-04-26T03:56:43","slug":"kotlin-1-5-0-rc-released-ja","status":"publish","type":"kotlin","link":"https:\/\/blog.jetbrains.com\/ja\/kotlin\/2021\/04\/kotlin-1-5-0-rc-released-ja\/","title":{"rendered":"Kotlin 1.5.0-RC \u30ea\u30ea\u30fc\u30b9: \u6a19\u6e96\u30e9\u30a4\u30d6\u30e9\u30ea\u3068\u30c6\u30b9\u30c8\u30e9\u30a4\u30d6\u30e9\u30ea\u306e\u5909\u66f4\u70b9"},"content":{"rendered":"<p>Kotlin 1.5.0-RC \u3067\u306f 1.5.0 \u3078\u306e\u642d\u8f09\u304c\u4e88\u5b9a\u3055\u308c\u3066\u3044\u308b\u3059\u3079\u3066\u306e\u6a5f\u80fd\u304c\u4f7f\u7528\u3067\u304d\u307e\u3059\u3002\u4eca\u5f8c\u306e\u30ea\u30ea\u30fc\u30b9\u306e\u5b8c\u5168\u306a\u30b9\u30b3\u30fc\u30d7\u3092\u3054\u89a7\u304f\u3060\u3055\u3044\uff01 \u65b0\u3057\u3044\u8a00\u8a9e\u6a5f\u80fd\u3084 stdlib \u306e\u66f4\u65b0\u3001\u6539\u826f\u3055\u308c\u305f\u30c6\u30b9\u30c8\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u306f\u3058\u3081\u3068\u3059\u308b\u3001\u3055\u307e\u3056\u307e\u306a\u5909\u66f4\u5185\u5bb9\u304c\u4ed5\u4e0a\u3052\u306e\u6700\u7d42\u6bb5\u968e\u306b\u5165\u3063\u3066\u3044\u307e\u3059\u3002 \u30ea\u30ea\u30fc\u30b9\u524d\u306b\u306f\u3001\u6700\u5f8c\u306e\u5909\u66f4\u3068\u3057\u3066\u4fee\u6b63\u4f5c\u696d\u304c\u3044\u304f\u3064\u304b\u884c\u308f\u308c\u307e\u3059\u3002<\/p>\n<\/p>\n<p>\u5b9f\u969b\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3067 1.5.0-RC \u3092\u4f7f\u3063\u3066\u6700\u65b0\u306e Kotlin API \u3092\u304a\u8a66\u3057\u304f\u3060\u3055\u3044\u3002\u30ea\u30ea\u30fc\u30b9\u3055\u308c\u308b\u30d0\u30fc\u30b8\u30e7\u30f3\u306e\u6539\u5584\u306b\u305c\u3072\u3054\u5354\u529b\u304f\u3060\u3055\u3044\uff01 \u554f\u984c\u3092\u767a\u898b\u3057\u305f\u3089\u3001\u5f53\u793e\u306e\u8ab2\u984c\u30c8\u30e9\u30c3\u30ab\u30fc <a href=\"https:\/\/kotl.in\/issue\" target=\"_blank\" rel=\"noopener\">YouTrack<\/a> \u307e\u3067\u3054\u5831\u544a\u304f\u3060\u3055\u3044\u3002<\/p>\n<p align=\"center\"><a class=\"jb-download-button\" title=\"\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\" href=\"https:\/\/kotlinlang.org\/docs\/install-eap-plugin.html\" target=\"_blank\" rel=\"noopener\">1.5.0-RC \u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/a><\/p>\n<p>\u3053\u306e\u8a18\u4e8b\u3067\u306f\u30011.5.0-RC \u3067 Kotlin \u6a19\u6e96\u30e9\u30a4\u30d6\u30e9\u30ea\u3068\u30c6\u30b9\u30c8\u30e9\u30a4\u30d6\u30e9\u30ea\u306b\u52a0\u3048\u3089\u308c\u305f\u4ee5\u4e0b\u306e\u5909\u66f4\u5185\u5bb9\u306b\u3064\u3044\u3066\u898b\u3066\u884c\u304d\u307e\u3059\u3002<\/p>\n<ul>\n<li><a href=\"https:\/\/blog.jetbrains.com\/kotlin\/2021\/04\/kotlin-1-5-0-rc-released\/#stable-unsigned-integer-types\">Stable \u5316\u3057\u305f\u7b26\u53f7\u306a\u3057\u6574\u6570\u578b<\/a><\/li>\n<li><a href=\"https:\/\/blog.jetbrains.com\/kotlin\/2021\/04\/kotlin-1-5-0-rc-released\/#extensions-for-java-nio-path\">java.nio.file.Path \u5411\u3051\u306e\u62e1\u5f35\u6a5f\u80fd<\/a><\/li>\n<li><a href=\"https:\/\/blog.jetbrains.com\/kotlin\/2021\/04\/kotlin-1-5-0-rc-released\/#locale-agnostic-upper-lowercase\">String API \u3068 Char API \u306e\u6539\u5584<\/a><\/li>\n<li><a href=\"https:\/\/blog.jetbrains.com\/kotlin\/2021\/04\/kotlin-1-5-0-rc-released\/#duration-api-changes\">Duration API \u3078\u306e\u5909\u66f4\u5185\u5bb9<\/a><\/li>\n<li><a href=\"https:\/\/blog.jetbrains.com\/kotlin\/2021\/04\/kotlin-1-5-0-rc-released\/#math-operations-floordiv-mod\">\u30e2\u30b8\u30e5\u30e9\u7b97\u8853\u306b\u52a0\u3048\u3089\u308c\u305f\u65b0\u3057\u3044\u6570\u5b66\u6f14\u7b97<\/a><\/li>\n<li><a href=\"https:\/\/blog.jetbrains.com\/kotlin\/2021\/04\/kotlin-1-5-0-rc-released\/#collections-firstnotnullof\">Collection \u306e\u65b0\u3057\u3044\u95a2\u6570<\/a><\/li>\n<li><a href=\"https:\/\/blog.jetbrains.com\/kotlin\/2021\/04\/kotlin-1-5-0-rc-released\/#test-library-changes\">\u30c6\u30b9\u30c8\u30e9\u30a4\u30d6\u30e9\u30ea\u3078\u306e\u5909\u66f4\u5185\u5bb9<\/a><\/li>\n<\/ul>\n<p>\u8a73\u3057\u304f\u306f\u4ee5\u4e0b\u3092\u304a\u8aad\u307f\u304f\u3060\u3055\u3044\uff01<\/p>\n<p><a name = \"stable-unsigned-integer-types\"><\/a><\/p>\n<h2>Stable \u5316\u3057\u305f\u7b26\u53f7\u306a\u3057\u6574\u6570\u578b<\/h2>\n<p>\u6a19\u6e96\u30e9\u30a4\u30d6\u30e9\u30ea\u306b\u306f\u3001\u8ca0\u4ee5\u5916\u306e\u6574\u6570\u3092\u4f34\u3046\u6f14\u7b97\u306b\u4fbf\u5229\u306a\u7b26\u53f7\u306a\u3057\u6574\u6570\u7528\u306e API \u304c\u542b\u307e\u308c\u3066\u3044\u307e\u3059\u3002 \u6b21\u3092\u542b\u307f\u307e\u3059\uff1a<\/p>\n<ul>\n<li>\u7b26\u53f7\u306e\u306a\u3044\u6570\u5024\u578b (<code>UInt<\/code>\u3001<code>ULong<\/code>\u3001<code>UByte<\/code>\u3001<code>UShort<\/code>)\u3001\u304a\u3088\u3073\u95a2\u9023\u3059\u308b\u95a2\u6570 (\u578b\u5909\u63db\u306a\u3069)\u3002<\/li>\n<li>\u96c6\u5408\u578b (Arrray\u3001Range)\u3001\u7b26\u53f7\u306a\u3057\u6574\u6570\u306e\u6570\u5217 (<code>UIntArray<\/code>\u3001<code>UIntRange<\/code>)\u3001\u304a\u3088\u3073\u4ed6\u306e\u578b\u7528\u306b\u4f7f\u3046\u985e\u4f3c\u306e\u30b3\u30f3\u30c6\u30ca\u3002<\/li>\n<\/ul>\n<p>\u7b26\u53f7\u306a\u3057\u6574\u6570\u578b\u306f\u3001<a href=\"https:\/\/kotlinlang.org\/docs\/whatsnew13.html#unsigned-integers\" target=\"_blank\" rel=\"noopener\">Kotlin 1.3<\/a> \u306e\u30d9\u30fc\u30bf\u7248\u304b\u3089\u7d44\u307f\u8fbc\u307e\u308c\u3066\u3044\u307e\u3059\u3002 \u4eca\u56de\u306e\u30ea\u30ea\u30fc\u30b9\u306b\u3088\u308a\u3001\u7b26\u53f7\u306a\u3057\u6574\u6570\u578b\u3068\u305d\u308c\u3092\u4f34\u3046\u6f14\u7b97\u3092 Stable \u5316\u3057\u305f\u3057\u305f\u3082\u306e\u3068\u5206\u985e\u3057\u3001\u5b9f\u969b\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3067\u30aa\u30d7\u30c8\u30a4\u30f3\u306a\u3057\u3067\u5b89\u5168\u306b\u4f7f\u7528\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>\u4e3b\u306b\u3001\u4ee5\u4e0b\u304c Stable \u5316\u3057\u305f API \u3068\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<ul>\n<li>\u7b26\u53f7\u306a\u3057\u6574\u6570\u578b<\/li>\n<li>Range \u304a\u3088\u3073\u7b26\u53f7\u306a\u3057\u6574\u6570\u578b\u306e\u6570\u5217<\/li>\n<li>\u7b26\u53f7\u306a\u3057\u6574\u6570\u578b\u3092\u4f34\u3046\u6f14\u7b97\u304c\u3067\u304d\u308b\u95a2\u6570<\/li>\n<\/ul>\n<p><pre class=\"kotlin-code\" data-version=\"1.5.0-RC\" theme=\"idea\" indent=\"4\" style=\"visibility: hidden; padding: 36px 0;\">\r\nfun main() {\r\n\/\/sampleStart\r\n    val zero = 0U \/\/ Define unsigned numbers with literal suffixes\r\n    val ten = 10.toUInt() \/\/ or by converting non-negative signed numbers\r\n    \/\/val minusOne: UInt = -1U \/\/ Error: unary minus is not defined\r\n    val range: UIntRange = zero..ten \/\/ Separate types for ranges and progressions\r\n\r\n    for (i in range) print(i)\r\n    println()\r\n    println(&quot;UInt covers the range from ${UInt.MIN_VALUE} to ${UInt.MAX_VALUE}&quot;) \/\/ UInt covers the range from 0 to 4294967295\r\n\/\/sampleEnd\r\n}\r\n<\/pre>\n<\/p>\n<p>\u7b26\u53f7\u306a\u3057\u6574\u6570\u306e\u914d\u5217\u306f\u3001\u5f15\u304d\u7d9a\u304d\u30d9\u30fc\u30bf\u7248\u3067\u306e\u4f7f\u7528\u3068\u306a\u308a\u307e\u3059\u3002 \u914d\u5217\u304c\u6e21\u3055\u308c\u308b\u7b26\u53f7\u306a\u3057\u6574\u6570\u306e <a href=\"https:\/\/kotlinlang.org\/docs\/functions.html#variable-number-of-arguments-varargs\" target=\"_blank\" rel=\"noopener\">varargs<\/a> \u3082\u540c\u3058\u3067\u3059\u3002 \u30b3\u30fc\u30c9\u306b\u4f7f\u7528\u3059\u308b\u5834\u5408\u306f\u3001<code>@ExperimentalUnsignedTypes<\/code> \u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u3092\u4f7f\u3063\u3066\u30aa\u30d7\u30c8\u30a4\u30f3\u3067\u304d\u307e\u3059\u3002<\/p>\n<p><a href=\"https:\/\/kotlinlang.org\/docs\/basic-types.html#unsigned-integers\" target=\"_blank\" rel=\"noopener\">Kotlin \u306e\u7b26\u53f7\u306a\u3057\u6574\u6570<\/a>\u306b\u3064\u3044\u3066\u8a73\u3057\u304f\u898b\u308b\u3002<\/p>\n<p><a name = \"extensions-for-java-nio-path\"><\/a><\/p>\n<h2>java.nio.file.Path API \u306e\u62e1\u5f35\u6a5f\u80fd<\/h2>\n<p>Kotlin \u3067\u306f\u3001<a href=\"https:\/\/docs.oracle.com\/javase\/7\/docs\/api\/java\/nio\/file\/Path.html\" target=\"_blank\" rel=\"noopener\"><code>java.nio.file.Path<\/code><\/a> \u306e\u62e1\u5f35\u95a2\u6570\u3092\u4f7f\u3048\u3070\u3001\u6700\u65b0\u306e<a href=\"https:\/\/docs.oracle.com\/javase\/8\/docs\/api\/java\/nio\/package-summary.html\" target=\"_blank\" rel=\"noopener\">\u975e\u30d6\u30ed\u30c3\u30ad\u30f3\u30b0 Java I\/O<\/a> \u3092\u305d\u306e\u307e\u307e Kotlin-idiomatic \u30b9\u30bf\u30a4\u30eb\u3067\u5229\u7528\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>\u3053\u3061\u3089\u304c\u305d\u306e\u4e00\u4f8b\u3067\u3059\u3002<\/p>\n<pre class=\"kotlin-code\" data-highlight-only=\"true\" theme=\"idea\" indent=\"4\" style=\"visibility: hidden; padding: 36px 0;\">\r\nimport kotlin.io.path.*\r\nimport java.nio.file.Path\r\n\r\nfun main() {\r\n    \/\/ construct path with the div (\/) operator\r\n    val baseDir = Path(&quot;\/base&quot;)\r\n    val subDir = baseDir \/ &quot;subdirectory&quot;\r\n\r\n    \/\/ list files in a directory\r\n    val kotlinFiles = Path(&quot;\/home\/user&quot;).listDirectoryEntries(&quot;*.kt&quot;)\r\n    \/\/ count lines in all kotlin files\r\n    val totalLines = kotlinFiles.sumOf { file -&gt; file.useLines { lines -&gt; lines.count() } }\r\n}\r\n<\/pre>\n<p>\u3053\u308c\u3089\u306e\u62e1\u5f35\u6a5f\u80fd\u306f\u3001<a href=\"https:\/\/kotlinlang.org\/docs\/whatsnew1420.html#extensions-for-java-nio-file-path\" target=\"_blank\" rel=\"noopener\">Kotlin 1.4.20<\/a> \u306b\u8a66\u9a13\u7684\u306a\u6a5f\u80fd\u3068\u3057\u3066\u5c0e\u5165\u3055\u308c\u305f\u3082\u306e\u3067\u3059\u304c\u3001\u4eca\u56de\u30aa\u30d7\u30c8\u30a4\u30f3\u306a\u3057\u3067\u4f7f\u7528\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002 \u4f7f\u7528\u3067\u304d\u308b\u6a5f\u80fd\u306e\u4e00\u89a7\u306f\u3001<a href=\"https:\/\/kotlinlang.org\/api\/latest\/jvm\/stdlib\/kotlin.io.path\/\" target=\"_blank\" rel=\"noopener\"><code>kotlin.io.path<\/code><\/a> \u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u3054\u89a7\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>File API \u306e\u65e2\u5b58\u306e\u62e1\u5f35\u6a5f\u80fd\u306f\u5f15\u304d\u7d9a\u304d\u4f7f\u7528\u3067\u304d\u307e\u3059\u306e\u3067\u3001\u304a\u6c17\u306b\u5165\u308a\u306e API \u3092\u81ea\u7531\u306b\u9078\u629e\u3067\u304d\u307e\u3059\u3002<\/p>\n<p><a name = \"locale-agnostic-upper-lowercase\"><\/a><\/p>\n<h2>\u30ed\u30b1\u30fc\u30eb\u306b\u4f9d\u5b58\u305b\u305a\u306b\u4f7f\u3048\u308b\u5927\u6587\u5b57\u30fb\u5c0f\u6587\u5b57\u306e API<\/h2>\n<p>\u7686\u3055\u3093\u306e\u591a\u304f\u306f\u3001<code>toUpperCase()<\/code>\u3001<code>toLowerCase()<\/code>\u3001<code>toTitleCase()<\/code> \u306a\u3069\u3001\u6587\u5b57\u5217\u3084\u6587\u5b57\u306e\u5927\u6587\u5b57\u30fb\u5c0f\u6587\u5b57\u3092\u5909\u63db\u3059\u308b stdlib \u95a2\u6570\u306b\u3064\u3044\u3066\u3054\u5b58\u77e5\u304b\u3068\u601d\u3044\u307e\u3059\u3002 \u3053\u3046\u3057\u305f\u95a2\u6570\u306f\u3001\u666e\u6bb5\u306f\u554f\u984c\u306a\u304f\u6a5f\u80fd\u3059\u308b\u306e\u3067\u3059\u304c\u3001\u30d7\u30e9\u30c3\u30c8\u30d5\u30a9\u30fc\u30e0\u306e\u30ed\u30b1\u30fc\u30eb\u304c\u5909\u308f\u308b\u3068\u4e0d\u4fbf\u306a\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002\u30ed\u30b1\u30fc\u30eb\u306e\u5f71\u97ff\u3092\u53d7\u3051\u308b\u95a2\u6570\u3067\u3042\u308b\u305f\u3081\u3001\u30ed\u30b1\u30fc\u30eb\u306b\u3088\u3063\u3066\u306f\u7d50\u679c\u304c\u5909\u308f\u3063\u3066\u3057\u307e\u3046\u5834\u5408\u304c\u3042\u308b\u306e\u3067\u3059\u3002 \u305f\u3068\u3048\u3070\u3001<code>\u201dKotlin\u201d.toUpperCase()<\/code> \u306e\u5b9f\u884c\u7d50\u679c\u306f\u3069\u3046\u306a\u308a\u307e\u3059\u304b\uff1f \u300c\u660e\u3089\u304b\u306b <code>KOTLIN<\/code> \u3067\u3059\u300d\u3068\u8a00\u308f\u308c\u308b\u3067\u3057\u3087\u3046\u3002 \u3067\u3059\u304c\u3001\u30ed\u30b1\u30fc\u30eb\u304c\u30c8\u30eb\u30b3\u306e\u5834\u5408\u3060\u3068\u3001<code>i<\/code> \u306e\u5927\u6587\u5b57\u306f <code>\u0130<\/code> \u3067\u3059\u306e\u3067\u3001\u5b9f\u884c\u7d50\u679c\u306f\u5c11\u3057\u9055\u3063\u3066 <code>KOTL\u0130N<\/code> \u306b\u306a\u3063\u3066\u3057\u307e\u3046\u306e\u3067\u3059\u3002<\/p>\n<p>\u4eca\u56de\u306e\u30ea\u30ea\u30fc\u30b9\u306b\u306f\u3001\u6587\u5b57\u5217\u3084\u6587\u5b57\u306e\u5927\u6587\u5b57\u30fb\u5c0f\u6587\u5b57\u306e\u5909\u63db\u306b\u4fbf\u5229\u306a <code>uppercase()<\/code>\u3001<code>lowercase()<\/code>\u3001<code>titlecase()<\/code> \u3068\u3044\u3063\u305f\u95a2\u6570\u304c\u30ed\u30b1\u30fc\u30eb\u306b\u4f9d\u5b58\u3057\u306a\u3044 API \u3068\u3057\u3066\u3001\u305d\u308c\u305e\u308c <code>*Char()<\/code> \u95a2\u6570\u3068\u5171\u306b\u76db\u308a\u8fbc\u307e\u308c\u3066\u3044\u307e\u3059\u3002 \u3059\u3067\u306b <a href=\"https:\/\/kotlinlang.org\/docs\/whatsnew1430.html#locale-agnostic-api-for-upper-lowercasing-text\" target=\"_blank\" rel=\"noopener\">1.4.30 \u306e\u30d7\u30ec\u30d3\u30e5\u30fc\u5b9f\u88c5<\/a>\u3092\u304a\u8a66\u3057\u306b\u306a\u3063\u3066\u3044\u308b\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002<\/p>\n<p>\u4eca\u56de\u306e\u65b0\u3057\u3044\u95a2\u6570\u306f\u3001\u30d7\u30e9\u30c3\u30c8\u30d5\u30a9\u30fc\u30e0\u306e\u30ed\u30b1\u30fc\u30eb\u8a2d\u5b9a\u3092\u554f\u308f\u305a\u3001\u540c\u3058\u3088\u3046\u306b\u6a5f\u80fd\u3057\u307e\u3059\u3002 \u95a2\u6570\u3092\u547c\u3073\u51fa\u305b\u3070\u3001\u3042\u3068\u306f stdlib \u304c\u51e6\u7406\u3057\u3066\u304f\u308c\u307e\u3059\u3002<\/p>\n<p>\u65b0\u3057\u3044\u95a2\u6570\u306f\u3001\u30d7\u30e9\u30c3\u30c8\u30d5\u30a9\u30fc\u30e0\u306e\u30ed\u30b1\u30fc\u30eb\u3092\u554f\u308f\u305a\u3001\u540c\u3058\u3088\u3046\u306b\u6a5f\u80fd\u3057\u307e\u3059\u3002 \u95a2\u6570\u3092\u547c\u3073\u51fa\u305b\u3070\u3001\u3042\u3068\u306f stdlib \u304c\u51e6\u7406\u3057\u3066\u304f\u308c\u307e\u3059\u3002<\/p>\n<pre class=\"kotlin-code\" data-version=\"1.5.0-RC\" theme=\"idea\" indent=\"4\" style=\"visibility: hidden; padding: 36px 0;\">\r\nfun main() {\r\n\/\/sampleStart\r\n    \/\/ replace the old API\r\n    println(&quot;Kotlin&quot;.toUpperCase()) \/\/ KOTLIN or KOTL\u0130N or?..\r\n\r\n    \/\/ with the new API\r\n    println(&quot;Kotlin&quot;.uppercase()) \/\/ Always KOTLIN\r\n\/\/sampleEnd\r\n}\r\n<\/pre>\n<\/p>\n<p>JVM \u3067\u306f\u3001\u73fe\u5728\u306e\u30ed\u30b1\u30fc\u30eb\u3092\u5f15\u6570\u3068\u3057\u3066\u65b0\u3057\u3044\u95a2\u6570\u3092\u547c\u3073\u51fa\u305b\u3070\u3001\u30ed\u30b1\u30fc\u30eb\u306b\u6ce8\u610f\u304c\u5fc5\u8981\u306a\u5927\u6587\u5b57\u30fb\u5c0f\u6587\u5b57\u306e\u5909\u63db\u3067\u3082\u554f\u984c\u306a\u304f\u5b9f\u884c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"kotlin-code\" data-highlight-only=\"true\" theme=\"idea\" indent=\"4\" style=\"visibility: hidden; padding: 36px 0;\">\r\n&quot;Kotlin&quot;.uppercase(Locale.getDefault()) \/\/ Locale-sensitive uppercasing\r\n<\/pre>\n<p>\u65b0\u3057\u3044\u95a2\u6570\u306f\u3001\u5b8c\u5168\u306b\u53e4\u3044\u3082\u306e\u306b\u53d6\u3063\u3066\u4ee3\u308f\u308a\u3001\u53e4\u3044\u3082\u306e\u306f\u975e\u63a8\u5968\u3068\u3059\u308b\u3053\u3068\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<h2>\u5206\u304b\u308a\u3084\u3059\u304f\u306a\u3063\u305f Char-to-code \u3068 Char-to-digit \u5909\u63db<\/h2>\n<p>\u6587\u5b57\u578b\u306e UTF-16 \u30b3\u30fc\u30c9\u3092\u53d6\u5f97\u3059\u308b\u64cd\u4f5c (<code>toInt()<\/code> \u95a2\u6570) \u306f\u3001\u3088\u304f\u77e5\u3089\u308c\u305f\u843d\u3068\u3057\u7a74\u3068\u306a\u3063\u3066\u3044\u307e\u3057\u305f\u3002\u306a\u305c\u306a\u3089\u30011 \u6841\u306e\u6570\u5024\u6587\u5b57\u5217\u306b\u5bfe\u3057\u3066\u5b9f\u884c\u3055\u308c\u3001\u305d\u306e\u6570\u5024\u305d\u306e\u3082\u306e\u3092 <code>Int<\/code> \u3068\u3057\u3066\u4f5c\u6210\u3059\u308b <code>String.toInt()<\/code> \u306b\u3088\u304f\u4f3c\u3066\u3044\u308b\u304b\u3089\u3067\u3059\u3002<\/p>\n<p><pre class=\"kotlin-code\" data-highlight-only=\"true\" theme=\"idea\" indent=\"4\" style=\"visibility: hidden; padding: 36px 0;\">\r\n&quot;4&quot;.toInt() \/\/ returns 4\r\n&#039;4&#039;.toInt() \/\/ returns 52\r\n<\/pre>\n<\/p>\n<p>\u307e\u305f\u3001<code>Char<\/code> <code>'4'<\/code> \u306b\u5bfe\u3057\u3066\u5b9f\u884c\u3055\u308c\u308b\u3068\u304d\u306b\u3001\u6570\u5024\u306e <code>4<\/code> \u3092\u8fd4\u3059\u4e00\u822c\u7684\u306a\u95a2\u6570\u3082\u3042\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u3002<\/p>\n<p>\u3053\u3046\u3057\u305f\u8ab2\u984c\u3092\u89e3\u6c7a\u3059\u308b\u305f\u3081\u306b\u3001\u6587\u5b57\u578b\u3068\u305d\u306e\u6574\u6570\u30b3\u30fc\u30c9\u304a\u3088\u3073\u6570\u5024\u306e\u9593\u3067\u5909\u63db\u64cd\u4f5c\u3092\u884c\u3048\u308b\u4ee5\u4e0b\u306e\u95a2\u6570\u304c\u958b\u767a\u3055\u308c\u307e\u3057\u305f\u3002<\/p>\n<ul>\n<li><code>Char(code)<\/code> \u3068 <code>Char.code<\/code> \u306f\u6587\u5b57\u3068\u305d\u306e\u30b3\u30fc\u30c9\u306e\u9593\u3067\u5909\u63db\u3092\u884c\u3044\u307e\u3059\u3002<\/li>\n<li><code>Char.digitToInt(radix: Int)<\/code> \u304a\u3088\u3073 <code>*OrNull<\/code> \u3092\u4f7f\u3063\u305f\u30d0\u30fc\u30b8\u30e7\u30f3\u306f\u3001radix \u306b\u6307\u5b9a\u3055\u308c\u308b\u6570\u5024\u3067\u6574\u6570\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/li>\n<li><code>Int.digitToChar(radix: Int)<\/code> \u306f\u3001radix \u306b\u6307\u5b9a\u3055\u308c\u308b\u6574\u6570\u3092\u8868\u3059\u6570\u5024\u3067\u6587\u5b57\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/li>\n<\/ul>\n<p>\u3053\u308c\u3089\u306e\u95a2\u6570\u306b\u306f\u5206\u304b\u308a\u3084\u3059\u3044\u540d\u524d\u304c\u4ed8\u3051\u3089\u308c\u3066\u3044\u308b\u305f\u3081\u3001\u30b3\u30fc\u30c9\u304c\u8aad\u307f\u3084\u3059\u304f\u306a\u308a\u307e\u3059\u3002<\/p>\n<p><pre class=\"kotlin-code\" data-version=\"1.5.0-RC\" theme=\"idea\" indent=\"4\" style=\"visibility: hidden; padding: 36px 0;\">\r\nfun main() {\r\n\/\/sampleStart\r\n    val capsK = Char(75) \/\/ \u2018K\u2019\r\n    val one = &#039;1&#039;.digitToInt(10) \/\/ 1\r\n    val digitC = 12.digitToChar(16) \/\/ hexadecimal digit \u2018C\u2019\r\n\r\n    println(&quot;${capsK}otlin ${one}.5.0-R${digitC}&quot;) \/\/ \u201cKotlin 1.5.0-RC\u201d\r\n    println(capsK.code) \/\/ 75\r\n\/\/sampleEnd\r\n}\r\n<\/pre>\n<\/p>\n<p>\u3053\u308c\u3089\u306f\u3001<a href=\"https:\/\/kotlinlang.org\/docs\/whatsnew1430.html#clear-char-to-code-and-char-to-digit-conversions\" target=\"_blank\" rel=\"noopener\">Kotlin 1.4.30 \u4ee5\u6765<\/a>\u30d7\u30ec\u30d3\u30e5\u30fc\u30e2\u30fc\u30c9\u3067\u306e\u307f\u4f7f\u7528\u3067\u304d\u307e\u3057\u305f\u304c\u3001\u4eca\u56de\u306e\u30ea\u30ea\u30fc\u30b9\u3067 Stable \u5316\u3055\u308c\u307e\u3057\u305f\u3002 \u6587\u5b57\u3092\u6570\u5b57\u306b\u5909\u63db\u3059\u308b\u53e4\u3044\u95a2\u6570 (<code>Char.toInt()<\/code> \u304a\u3088\u3073\u4ed6\u306e\u6570\u5024\u578b\u306b\u4f7f\u3046\u985e\u4f3c\u306e\u95a2\u6570) \u304a\u3088\u3073\u6570\u5b57\u3092\u6587\u5b57\u306b\u5909\u63db\u3059\u308b\u53e4\u3044\u95a2\u6570 (<code>Long.toChar()<\/code> \u304a\u3088\u3073 <code>Int.toChar()<\/code> \u3092\u9664\u304f\u985e\u4f3c\u306e\u95a2\u6570) \u306f\u975e\u63a8\u5968\u3068\u3055\u308c\u307e\u3057\u305f\u3002<\/p>\n<h2>\u30de\u30eb\u30c1\u30d7\u30e9\u30c3\u30c8\u30d5\u30a9\u30fc\u30e0\u5bfe\u5fdc Char API \u306e\u62e1\u5f35<\/h2>\n<p>\u5f53\u793e\u306f\u3001\u30de\u30eb\u30c1\u30d7\u30e9\u30c3\u30c8\u30d5\u30a9\u30fc\u30e0\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u5171\u901a\u30b3\u30fc\u30c9\u306b\u6a19\u6e96\u30e9\u30a4\u30d6\u30e9\u30ea\u306e\u3059\u3079\u3066\u306e\u6a5f\u80fd\u3092\u4f7f\u7528\u3067\u304d\u308b\u3088\u3046\u3001\u5f15\u304d\u7d9a\u304d\u30de\u30eb\u30c1\u30d7\u30e9\u30c3\u30c8\u30d5\u30a9\u30fc\u30e0\u5bfe\u5fdc\u6a5f\u80fd\u306e\u62e1\u5f35\u306b\u53d6\u308a\u7d44\u3093\u3067\u3044\u307e\u3059\u3002<\/p>\n<p>\u3042\u3089\u3086\u308b\u30d7\u30e9\u30c3\u30c8\u30d5\u30a9\u30fc\u30e0\u3084\u5171\u901a\u30b3\u30fc\u30c9\u3067\u4f7f\u7528\u3067\u304d\u308b <code>Char<\/code> \u95a2\u6570\u3092\u3044\u304f\u3064\u304b\u4f5c\u6210\u3057\u307e\u3057\u305f\u3002 \u4ee5\u4e0b\u304c\u305d\u306e\u95a2\u6570\u3067\u3059\u3002<\/p>\n<ul>\n<li><code>Char.isDigit()<\/code>\u3001<code>Char.isLetter()<\/code>\u3001char \u304c\u6587\u5b57\u306a\u306e\u304b\u3001\u6570\u5b57\u306a\u306e\u304b\u3092\u30c1\u30a7\u30c3\u30af\u3059\u308b <code>Char.isLetterOrDigit()<\/code>\u3002<\/li>\n<li><code>Char.isLowerCase()<\/code>\u3001<code>Char.isUpperCase()<\/code>\u3001Char \u304c\u5927\u6587\u5b57\u306a\u306e\u304b\u5c0f\u6587\u5b57\u306a\u306e\u304b\u3092\u30c1\u30a7\u30c3\u30af\u3059\u308b <code>Char.isTitleCase()<\/code>\u3002<\/li>\n<li>char \u304c <code>Cn<\/code> (<em>\u672a\u5b9a\u7fa9<\/em>) \u4ee5\u5916\u306e <a href=\"https:\/\/unicode.org\/reports\/tr44\/#General_Category_Values\" target=\"_blank\" rel=\"noopener\">Unicode \u4e00\u822c\u30ab\u30c6\u30b4\u30ea<\/a> \u3092\u6301\u3063\u3066\u3044\u308b\u306e\u304b\u3092\u30c1\u30a7\u30c3\u30af\u3059\u308b <code>Char.isDefined()<\/code>\u3002<\/li>\n<li>char \u304c <code>\\u0000<\/code>..<code>\\u001F<\/code> \u307e\u305f\u306f <code>\\u007F<\/code>..<code>\\u009F<\/code> \u306e\u7bc4\u56f2\u306e\u30b3\u30fc\u30c9\u3092\u6301\u3064 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Control_character\" target=\"_blank\" rel=\"noopener\">ISO \u5236\u5fa1\u6587\u5b57<\/a> \u306a\u306e\u304b\u3092\u30c1\u30a7\u30c3\u30af\u3059\u308b <code>Char.isISOControl()<\/code>\u3002<\/li>\n<\/ul>\n<p>\u30d7\u30ed\u30d1\u30c6\u30a3 <code>Char.category<\/code> \u304a\u3088\u3073\u305d\u306e\u8fd4\u308a\u5024\u306e\u578b\u3067\u3001Unicode \u306b\u5f93\u3063\u3066\u6587\u5b57\u306e\u4e00\u822c\u30ab\u30c6\u30b4\u30ea\u30fc\u3092\u793a\u3059 enum \u30af\u30e9\u30b9 <code>CharCategory<\/code> \u304c\u30de\u30eb\u30c1\u30d7\u30e9\u30c3\u30c8\u30d5\u30a9\u30fc\u30e0\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3067\u4f7f\u7528\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<p><pre class=\"kotlin-code\" data-version=\"1.5.0-RC\" theme=\"idea\" indent=\"4\" style=\"visibility: hidden; padding: 36px 0;\">\r\nfun main() {\r\n\/\/sampleStart\r\n    val array = &quot;Kotlin 1.5.0-RC&quot;.toCharArray()\r\n    val (letterOrDigit, punctuation) = array.partition { it.isLetterOrDigit() }\r\n    val (upperCase, notUpperCase ) = array.partition { it.isUpperCase() }\r\n\r\n    println(&quot;$letterOrDigit, $punctuation&quot;) \/\/ [K, o, t, l, i, n, 1, 5, 0, R, C], [ , ., ., -]\r\n    println(&quot;$upperCase, $notUpperCase&quot;) \/\/ [K, R, C], [o, t, l, i, n, , 1, ., 5, ., 0, -]\r\n\r\n    if (array[0].isDefined()) println(array[0].category)\r\n\/\/sampleEnd\r\n}\r\n<\/pre>\n<\/p>\n<h2>String?.toBoolean() \u306e\u53b3\u5bc6\u306a\u30d0\u30fc\u30b8\u30e7\u30f3<\/h2>\n<p>Kotlin \u306e <code>String?.toBoolean()<\/code> \u95a2\u6570\u306f\u3001\u6587\u5b57\u5217\u304b\u3089\u771f\u507d\u5024\u3092\u4f5c\u6210\u3059\u308b\u306e\u306b\u3088\u304f\u4f7f\u7528\u3055\u308c\u3066\u3044\u307e\u3059\u3002 \u305d\u306e\u6a5f\u80fd\u306f\u3001\u6587\u5b57\u5217\u304c &quot;true&quot; \u3067\u3042\u308c\u3070\u3001\u5927\u6587\u5b57\u304b\u5c0f\u6587\u5b57\u304b\u306b\u304b\u304b\u308f\u3089\u305a <code>true<\/code>\u3001\u305d\u308c\u4ee5\u5916\u306e\u6587\u5b57\u5217\u306f null \u3082\u542b\u3081\u3066\u3059\u3079\u3066 <code>false<\/code> \u3068\u306a\u308a\u3068\u3066\u3082\u30b7\u30f3\u30d7\u30eb\u3067\u3059\u3002<\/p>\n<p>\u3053\u308c\u306f\u81ea\u7136\u306a\u6319\u52d5\u306b\u601d\u3048\u308b\u4e00\u65b9\u3067\u3001\u6f5c\u5728\u7684\u306b\u8aa4\u308a\u306e\u3042\u308b\u72b6\u6cc1\u304c\u96a0\u308c\u3066\u3057\u307e\u3046\u5834\u5408\u304c\u3042\u308a\u307e\u3059\u3002 \u3053\u306e\u95a2\u6570\u3067\u4f55\u304b\u3092\u5909\u63db\u3059\u308b\u3068\u3001\u6587\u5b57\u5217\u306b\u4e88\u671f\u305b\u306c\u5024\u304c\u4ee3\u5165\u3055\u308c\u3066\u3044\u305f\u3068\u3057\u3066\u3082\u3001boolean \u304c\u8fd4\u3055\u308c\u3066\u3057\u307e\u3044\u307e\u3059\u3002<\/p>\n<p>\u305d\u3053\u3067\u3001\u305d\u3046\u3057\u305f\u30df\u30b9\u3092\u907f\u3051\u308b\u305f\u3081\u306b\u3001\u5927\u6587\u5b57\u30fb\u5c0f\u6587\u5b57\u3092\u533a\u5225\u3059\u308b <a href=\"https:\/\/kotlinlang.org\/api\/latest\/jvm\/stdlib\/kotlin.text\/to-boolean.html\" target=\"_blank\" rel=\"noopener\">String?.toBoolean()<\/a> \u306e\u53b3\u5bc6\u306a\u30d0\u30fc\u30b8\u30e7\u30f3\u304c\u65b0\u3057\u304f\u4f5c\u6210\u3055\u308c\u307e\u3057\u305f\u3002<\/p>\n<ul>\n<li><code>String.toBooleanStrict()<\/code> \u306f\u30ea\u30c6\u30e9\u30eb &#8220;true&#8221; \u3068 &#8220;false&#8221; \u4ee5\u5916\u306e\u3059\u3079\u3066\u306e\u5165\u529b\u306b\u5bfe\u3057\u3066\u4f8b\u5916\u3092\u6295\u3052\u307e\u3059\u3002<\/li>\n<li><code>String.toBooleanStrictOrNull()<\/code> \u306f\u30ea\u30c6\u30e9\u30eb &#8220;true&#8221; \u3068 &#8220;false&#8221; \u4ee5\u5916\u306e\u3059\u3079\u3066\u306e\u5165\u529b\u306b\u5bfe\u3057\u3066 null \u3092\u8fd4\u3057\u307e\u3059\u3002<\/li>\n<\/ul>\n<p><pre class=\"kotlin-code\" data-version=\"1.5.0-RC\" theme=\"idea\" indent=\"4\" style=\"visibility: hidden; padding: 36px 0;\">\r\nfun main() {\r\n\/\/sampleStart\r\n    println(&quot;true&quot;.toBooleanStrict()) \/\/ True\r\n    \/\/ println(&quot;1&quot;.toBooleanStrict()) \/\/ Exception\r\n    println(&quot;1&quot;.toBooleanStrictOrNull()) \/\/ null\r\n    println(&quot;True&quot;.toBooleanStrictOrNull()) \/\/ null: the function is case-sensitive\r\n\/\/sampleEnd\r\n}\r\n<\/pre>\n<\/p>\n<p><a name = \"duration-api-changes\"><\/a><\/p>\n<h2>Duration API \u3078\u306e\u5909\u66f4\u5185\u5bb9<\/h2>\n<p>experimental \u306a <a href=\"https:\/\/blog.jetbrains.com\/kotlin\/2019\/08\/kotlin-1-3-50-released\/#time-measurement-api\">Duration and Time Measurement API<\/a> \u306f\u3001\u30d0\u30fc\u30b8\u30e7\u30f3 1.3.50 \u4ee5\u6765\u3001stdlib \u306b\u5b9f\u88c5\u3055\u308c\u3066\u304d\u307e\u3057\u305f\u3002 \u6642\u9593\u9593\u9694\u3092\u6b63\u78ba\u306b\u6e2c\u5b9a\u3059\u308b\u305f\u3081\u306e API \u3092\u63d0\u4f9b\u3057\u3066\u304f\u308c\u307e\u3059\u3002<\/p>\n<p>\u3053\u306e API \u306e\u4e3b\u306a\u30af\u30e9\u30b9\u306e 1 \u3064\u306b <a href=\"https:\/\/kotlinlang.org\/api\/latest\/jvm\/stdlib\/kotlin.time\/-duration\/\" target=\"_blank\" rel=\"noopener\"><code>Duration<\/code><\/a> \u30af\u30e9\u30b9\u304c\u3042\u308a\u307e\u3059\u3002 2 \u3064\u306e\u6642\u523b\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u9593\u306e\u6642\u9593\u3092\u8868\u3057\u307e\u3059\u3002 \u30d0\u30fc\u30b8\u30e7\u30f3 1.5.0 \u3067\u306f\u3001<code>Duration<\/code> \u306e API \u3068\u5185\u90e8\u8868\u73fe\u306e\u4e21\u65b9\u306b\u91cd\u5927\u306a\u5909\u66f4\u304c\u52a0\u3048\u3089\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<p><code>Duration<\/code> \u3067\u306f\u5185\u90e8\u8868\u73fe\u306b <code>Double<\/code> \u5024\u3067\u306f\u306a\u304f <code>Long<\/code> \u5024\u304c\u4f7f\u7528\u3055\u308c\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002 <code>Long<\/code> \u5024\u304c\u5e45\u5e83\u3044\u7bc4\u56f2\u3092\u63d0\u4f9b\u3057\u3066\u304f\u308c\u308b\u304a\u304b\u3052\u3067\u3001 \u30ca\u30ce\u79d2\u306e\u7cbe\u5ea6\u3067\u306f 100 \u5e74\u4ee5\u4e0a\u3001\u30df\u30ea\u79d2\u306e\u7cbe\u5ea6\u3067\u306f 1 \u5104\u5e74\u4ee5\u4e0a\u306e\u6642\u9593\u3092\u8868\u73fe\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002 \u305f\u3060\u3057\u3001\u4ee5\u524d\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u3066\u3044\u305f\u30b5\u30d6\u30ca\u30ce\u79d2\u306e Duration \u306f\u4f7f\u7528\u3067\u304d\u306a\u304f\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>\u307e\u305f\u3001Duration \u3092 <code>Long<\/code> \u5024\u3068\u3057\u3066\u53d6\u5f97\u3059\u308b\u305f\u3081\u306e\u30d7\u30ed\u30d1\u30c6\u30a3\u3082\u5c0e\u5165\u3057\u3066\u3044\u307e\u3059\u3002 \u3053\u308c\u3089\u306f\u3001<code>Duration.inWholeMinutes<\/code> \u3084 <code>Duration.inWholeSeconds<\/code>\u306a\u3069\u3001\u3055\u307e\u3056\u307e\u306a \u6642\u9593\u5358\u4f4d\u3067\u4f7f\u7528\u3067\u304d\u307e\u3059\u3002 \u3053\u3046\u3057\u305f\u95a2\u6570\u306f\u3001<code>Duration.inMinutes<\/code> \u306a\u3069\u3001<code>Double<\/code> \u30d9\u30fc\u30b9\u306e\u30d7\u30ed\u30d1\u30c6\u30a3\u306b\u53d6\u3063\u3066\u4ee3\u308f\u308b\u3082\u306e\u3068\u3057\u3066\u4f5c\u6210\u3055\u308c\u307e\u3057\u305f\u3002<\/p>\n<p>\u3082\u3046 1 \u3064\u306e\u5909\u66f4\u70b9\u3068\u3057\u3066\u3001\u6574\u6570\u5024\u304b\u3089 <code>Duration<\/code> \u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u4f5c\u6210\u3059\u308b\u4e00\u9023\u306e\u30d5\u30a1\u30af\u30c8\u30ea\u95a2\u6570\u304c\u65b0\u305f\u306b\u4f5c\u6210\u3055\u308c\u307e\u3057\u305f\u3002 \u3053\u308c\u3089\u306f\u3001\u76f4\u63a5 <code>Duration<\/code> \u578b\u306e\u4e2d\u306b\u5b9a\u7fa9\u3055\u308c\u3001<code>Int.seconds<\/code> \u306e\u3088\u3046\u306a\u6570\u5024\u578b\u306e\u53e4\u3044\u62e1\u5f35\u30d7\u30ed\u30d1\u30c6\u30a3\u306b\u4ee3\u308f\u3063\u3066\u5b9f\u88c5\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"kotlin-code\" data-version=\"1.5.0-RC\" theme=\"idea\" indent=\"4\" style=\"visibility: hidden; padding: 36px 0;\">\r\nimport kotlin.time.ExperimentalTime\r\nimport kotlin.time.Duration\r\n\r\n@ExperimentalTime\r\nfun main() {\r\n    val duration = Duration.milliseconds(120000)\r\n    println(&quot;There are ${duration.inWholeSeconds} seconds in ${duration.inWholeMinutes} minutes&quot;)\r\n}\r\n<\/pre>\n<\/p>\n<p>\u3053\u3046\u3057\u305f\u5927\u304d\u306a\u5909\u66f4\u304c\u52a0\u3048\u3089\u308c\u3066\u3044\u308b\u3053\u3068\u3082\u3042\u308a\u3001Duration and Time Measurement API \u306f 1.5.0 \u3067\u3082\u5f15\u304d\u7d9a\u304d\u5168\u4f53\u7684\u306b experimental \u6bb5\u968e\u306b\u7559\u307e\u3063\u3066\u304a\u308a\u3001\u4f7f\u7528\u3059\u308b\u5834\u5408\u306f <code>@ExperimentalTime<\/code> \u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u306b\u3088\u308b\u30aa\u30d7\u30c8\u30a4\u30f3\u304c\u5fc5\u8981\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u305c\u3072\u3001\u65b0\u3057\u3044\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u304a\u8a66\u3057\u3044\u305f\u3060\u304d\u3001\u5f53\u793e\u306e\u8ab2\u984c\u30c8\u30e9\u30c3\u30ab\u30fc <a href=\"https:\/\/kotl.in\/issue\" target=\"_blank\" rel=\"noopener\">YouTrack<\/a> \u307e\u3067\u3054\u611f\u60f3\u3092\u304a\u805e\u304b\u305b\u304f\u3060\u3055\u3044\u3002<\/p>\n<p><a name = \"math-operations-floordiv-mod\"><\/a><\/p>\n<h2>\u6570\u5b66\u6f14\u7b97: \u5207\u308a\u6368\u3066\u9664\u7b97\u3068 mod \u6f14\u7b97\u5b50<\/h2>\n<p>Kotlin \u3067\u306f\u3001\u6574\u6570\u306b\u5bfe\u3057\u3066<a href=\"https:\/\/kotlinlang.org\/docs\/basic-types.html#operations\" target=\"_blank\" rel=\"noopener\">\u9664\u7b97\u6f14\u7b97\u5b50 (<code>\/<\/code>) <\/a>\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u306f\u3001<em>\u5207\u308a\u6368\u3066\u9664\u7b97<\/em>\u3092\u610f\u5473\u3057\u3001\u6f14\u7b97\u7d50\u679c\u306e\u5c11\u6570\u90e8\u304c\u7701\u7565\u3055\u308c\u307e\u3059\u3002 \u5408\u540c\u7b97\u8853\uff08\u30e2\u30b8\u30e5\u30e9\u8a08\u7b97\uff09\u3067\u306f\u3001\u6f14\u7b97\u306e\u7d50\u679c\u3092 (\u5c0f\u3055\u3044\u65b9\u306e\u6574\u6570\u306b\u5411\u3063\u3066) \u4e38\u3081\u308b<em>\u5e8a\u9664\u7b97<\/em>\u3068\u3044\u3046\u5225\u306e\u9078\u629e\u80a2\u3082\u3042\u308a\u3001\u8ca0\u6570\u306b\u5bfe\u3057\u3066\u4f7f\u7528\u3059\u308b\u3068\u7570\u306a\u308b\u7d50\u679c\u304c\u5f97\u3089\u308c\u307e\u3059\u3002<\/p>\n<p>\u3053\u308c\u307e\u3067\u3001\u5e8a\u9664\u7b97\u3092\u884c\u3046\u306b\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30ab\u30b9\u30bf\u30e0\u95a2\u6570\u304c\u5fc5\u8981\u3067\u3057\u305f\u3002<\/p>\n<p><pre class=\"kotlin-code\" data-highlight-only=\"true\" theme=\"idea\" indent=\"4\" style=\"visibility: hidden; padding: 36px 0;\">\r\nfun floorDivision(i: Int, j: Int): Int {\r\n    var result = i \/ j\r\n    if (i != 0 &amp;&amp; result &lt;= 0) result--\r\n    return result\r\n}\r\n<\/pre>\n<\/p>\n<p>1.5.0-RC \u3067\u306f\u3001\u6574\u6570\u306b\u5bfe\u3057\u3066\u5e8a\u9664\u7b97\u3092\u884c\u3046 <code>floorDiv()<\/code> \u95a2\u6570\u3092\u5c0e\u5165\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"kotlin-code\" data-version=\"1.5.0-RC\" theme=\"idea\" indent=\"4\" style=\"visibility: hidden; padding: 36px 0;\">\r\nfun main() {\r\n\/\/sampleStart\r\n    println(&quot;Truncated division -5\/3: ${-5 \/ 3}&quot;)\r\n    println(&quot;Floored division -5\/3: ${(-5).floorDiv(3)}&quot;)\r\n\/\/sampleEnd\r\n}\r\n<\/pre>\n<\/p>\n<p>1.5.0 \u3067\u306f\u3001\u65b0\u3057\u304f\u306a\u3063\u305f <code>mod()<\/code> \u95a2\u6570\u3082\u5c0e\u5165\u3057\u3066\u3044\u307e\u3059\u3002 \u4eca\u56de\u306e\u30ea\u30ea\u30fc\u30b9\u304b\u3089\u306f\u3001\u305d\u306e\u540d\u524d\u306e\u901a\u308a\u3001<em>\u5270\u4f59<\/em> (\u5e8a\u9664\u7b97\u306e\u7d50\u679c\u306e\u4f59\u308a) \u3092\u8fd4\u3059\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>Kotlin \u306e <code>rem()<\/code> (\u307e\u305f\u306f <code>%<\/code> \u6f14\u7b97\u5b50) \u3068\u306f\u7570\u306a\u308a\u307e\u3059\u3002 \u5270\u4f59\u3068\u306f <code>a<\/code> \u3068 <code>a.floorDiv(b) * b<\/code> \u306e\u5dee\u306e\u3053\u3068\u3067\u3059\u3002 0 \u4ee5\u5916\u306e\u5270\u4f59\u306f\u5e38\u306b <code>b<\/code> \u3068\u540c\u3058\u8a18\u53f7\u306b\u306a\u308b\u4e00\u65b9\u3067\u3001<code>a % b<\/code> \u306e\u5834\u5408\u306f\u9055\u3046\u8a18\u53f7\u306b\u306a\u308b\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002 \u305f\u3068\u3048\u3070\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u5faa\u74b0\u30ea\u30b9\u30c8\u3092\u5b9f\u88c5\u3059\u308b\u5834\u5408\u306b\u4fbf\u5229\u3067\u3059\u3002<\/p>\n<p><pre class=\"kotlin-code\" data-version=\"1.5.0-RC\" theme=\"idea\" indent=\"4\" style=\"visibility: hidden; padding: 36px 0;\">\r\nfun main() {\r\n\/\/sampleStart\r\n    fun getNextIndexCyclic(current: Int, size: Int ) = (current + 1).mod(size)\r\n    fun getPreviousIndexCyclic(current: Int, size: Int ) = (current - 1).mod(size)\r\n    \/\/ unlike %, mod() produces the expected non-negative value even if (current - 1) is less than 0\r\n\r\n    val size = 5\r\n    for (i in 0..(size * 2)) print(getNextIndexCyclic(i, size))\r\n    println()\r\n    for (i in 0..(size * 2)) print(getPreviousIndexCyclic(i, size))\r\n\/\/sampleEnd\r\n}\r\n<\/pre>\n<\/p>\n<p><a name = \"collections-firstnotnullof\"><\/a><\/p>\n<h2>Collections: firstNotNullOf() \u3068 firstNotNullOfOrNull()<\/h2>\n<p>Kotlin \u306e Collections API \u306f\u30d3\u30eb\u30c8\u30a4\u30f3\u95a2\u6570\u3092\u4f7f\u3063\u3066\u3088\u304f\u884c\u308f\u308c\u308b\u64cd\u4f5c\u3092\u5e45\u5e83\u304f\u30ab\u30d0\u30fc\u3057\u3066\u3044\u307e\u3059\u3002 \u7a00\u306a\u51e6\u7406\u3092\u884c\u3046\u5834\u5408\u306f\u3001\u3053\u3046\u3057\u305f\u95a2\u6570\u306e\u547c\u3073\u51fa\u3057\u3092\u7d44\u307f\u5408\u308f\u305b\u308b\u306e\u304c\u4e00\u822c\u7684\u3067\u3059\u3002 \u3061\u3083\u3093\u3068\u6a5f\u80fd\u306f\u3057\u307e\u3059\u304c\u3001\u3059\u3063\u304d\u308a\u3068\u3057\u305f\u30b3\u30fc\u30c9\u3092\u8a18\u8ff0\u3067\u304d\u306a\u3044\u3053\u3068\u304c\u3042\u308b\u4e0a\u306b\u3001\u30aa\u30fc\u30d0\u30fc\u30d8\u30c3\u30c9\u3082\u5897\u3048\u3066\u3057\u307e\u3044\u307e\u3059\u3002<\/p>\n<p>\u305f\u3068\u3048\u3070\u3001Collection \u8981\u7d20\u306b\u5bfe\u3057\u5b9f\u884c\u3055\u308c\u308b\u30bb\u30ec\u30af\u30bf\u95a2\u6570\u306e\u6700\u521d\u306e null \u4ee5\u5916\u306e\u7d50\u679c\u3092\u53d6\u5f97\u3059\u308b\u306b\u306f\u3001<code>mapNotNull()<\/code> \u3068 <code>first()<\/code> \u3092\u547c\u3073\u51fa\u3057\u3066\u3082\u3088\u3044\u3067\u3057\u3087\u3046\u3002 \u3053\u308c\u3092 1.5.0 \u3067\u306f\u3001\u65b0\u3057\u3044\u95a2\u6570 <code>firstNotNullOf()<\/code> \u3092\u4e00\u56de\u547c\u3073\u51fa\u3059\u3060\u3051\u3067\u3067\u304d\u307e\u3059\u3002 <code>firstNotNullOf()<\/code> \u306b\u5bfe\u5fdc\u3059\u308b\u95a2\u6570\u3068\u3057\u3066\u3001\u8fd4\u3059\u5024\u304c\u306a\u3044\u3068\u304d\u306b\u306f null \u3092\u4f5c\u6210\u3059\u308b <code>*orNull()<\/code> \u95a2\u6570\u3092\u4e00\u7dd2\u306b\u8ffd\u52a0\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u3053\u306e\u95a2\u6570\u3092\u4f7f\u3063\u3066\u30b3\u30fc\u30c9\u3092\u77ed\u304f\u3059\u308b\u65b9\u6cd5\u306e\u4f8b\u3092 1 \u3064\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n<p>null \u8a31\u5bb9\u30d7\u30ed\u30d1\u30c6\u30a3\u3092\u6301\u3064\u30af\u30e9\u30b9\u304c\u3042\u308a\u3001\u30af\u30e9\u30b9\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306e\u4e00\u89a7\u304b\u3089\u6700\u521d\u306e null \u4ee5\u5916\u306e\u5024\u3092\u53d6\u5f97\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u3068\u3057\u307e\u3059\u3002<\/p>\n<p><pre class=\"kotlin-code\" data-highlight-only=\"true\" theme=\"idea\" indent=\"4\" style=\"visibility: hidden; padding: 36px 0;\">\r\nclass Item(val name: String?)\r\n<\/pre>\n<\/p>\n<p>\u3053\u308c\u306f\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b Collection \u3092\u30a4\u30c6\u30ec\u30fc\u30b7\u30e7\u30f3\u3057\u3001\u30d7\u30ed\u30d1\u30c6\u30a3\u304c null \u3067\u306a\u3044\u304b\u3069\u3046\u304b\u3092\u78ba\u8a8d\u3059\u308b\u3053\u3068\u3067\u5b9f\u88c5\u3067\u304d\u307e\u3059\u3002<\/p>\n<p><pre class=\"kotlin-code\" data-highlight-only=\"true\" theme=\"idea\" indent=\"4\" style=\"visibility: hidden; padding: 36px 0;\">\r\n\/\/ Option 1: manual implementation\r\nfor (element in collection) {\r\n    val itemName = element.name\r\n    if (itemName != null) return itemName\r\n}\r\nreturn null\r\n<\/pre>\n<\/p>\n<p>\u4ed6\u306e\u65b9\u6cd5\u3068\u3057\u3066\u3001\u524d\u304b\u3089\u5b58\u5728\u3059\u308b\u95a2\u6570 <code>mapNotNull()<\/code> \u3068 <code>firstOrNull()<\/code> \u3092\u4f7f\u3046\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002 <code>mapNotNull()<\/code> \u3092\u4f7f\u3046\u3068\u3001\u4e2d\u9593\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u304c\u69cb\u7bc9\u3055\u308c\u3001\u7279\u306b\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u304c\u5927\u304d\u3044\u5834\u5408\u306f\u30e1\u30e2\u30ea\u304c\u3055\u3089\u306b\u5fc5\u8981\u3068\u306a\u308b\u305f\u3081\u6ce8\u610f\u304c\u5fc5\u8981\u3067\u3059\u3002 \u3057\u305f\u304c\u3044\u3001\u3053\u3053\u3067\u306f\u30b7\u30fc\u30b1\u30f3\u30b9\u3078\u306e\u5909\u63db\u3082\u5fc5\u8981\u306b\u306a\u308b\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p><pre class=\"kotlin-code\" data-highlight-only=\"true\" theme=\"idea\" indent=\"4\" style=\"visibility: hidden; padding: 36px 0;\">\r\n\/\/ Option 2: old stdlib functions\r\nreturn collection\r\n    \/\/ .asSequence() \/\/ Avoid creating intermediate list for big collections\r\n    .mapNotNull { it.name }\r\n    .firstOrNull()\r\n<\/pre>\n<\/p>\n<p>\u305d\u3057\u3066\u3001\u65b0\u3057\u3044\u95a2\u6570\u3092\u4f7f\u3046\u3068\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u8a18\u8ff0\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p><pre class=\"kotlin-code\" data-highlight-only=\"true\" theme=\"idea\" indent=\"4\" style=\"visibility: hidden; padding: 36px 0;\">\r\n\/\/ Option 3: new firstNotNullOfOrNull()\r\nreturn collection.firstNotNullOfOrNull { it.name }\r\n<\/pre>\n<\/p>\n<p><a name = \"test-library-changes\"><\/a><\/p>\n<h2>\u30c6\u30b9\u30c8\u30e9\u30a4\u30d6\u30e9\u30ea\u3078\u306e\u5909\u66f4\u5185\u5bb9<\/h2>\n<p>\u3053\u3053\u6700\u8fd1\u306e\u30ea\u30ea\u30fc\u30b9\u3067\u306f\u3001Kotlin \u306e\u30c6\u30b9\u30c8\u30e9\u30a4\u30d6\u30e9\u30ea <code>kotlin-test<\/code> \u306e\u30e1\u30b8\u30e3\u30fc\u306a\u30a2\u30c3\u30d7\u30c7\u30fc\u30c8\u306f\u5b9f\u73fe\u3067\u304d\u3066\u3044\u307e\u305b\u3093\u304c\u3001\u4eca\u56de\u3064\u3044\u306b\u3044\u304f\u3064\u304b\u5909\u66f4\u3092\u52a0\u3048\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3057\u305f\u3002 1.5.0-RC \u3067\u306f\u3001\u65b0\u6a5f\u80fd\u3092\u305f\u304f\u3055\u3093\u8a66\u3057\u3066\u3044\u305f\u3060\u3051\u307e\u3059\u3002<\/p>\n<ul>\n<li>\u30de\u30eb\u30c1\u30d7\u30e9\u30c3\u30c8\u30d5\u30a9\u30fc\u30e0\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306b\u304a\u3051\u308b <code>kotlin-test<\/code> \u306b\u5bfe\u3059\u308b\u4f9d\u5b58\u306e\u5358\u4e00\u5316\u3002<\/li>\n<li>Kotlin\/JVM \u30bd\u30fc\u30b9\u30bb\u30c3\u30c8\u7528\u30c6\u30b9\u30c8\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u306e\u81ea\u52d5\u9078\u629e\u3002<\/li>\n<li>\u30a2\u30b5\u30fc\u30b7\u30e7\u30f3\u95a2\u6570\u306e\u66f4\u65b0\u3002<\/li>\n<\/ul>\n<h3>\u30de\u30eb\u30c1\u30d7\u30e9\u30c3\u30c8\u30d5\u30a9\u30fc\u30e0\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306b\u304a\u3051\u308b kotlin-test \u3078\u306e\u4f9d\u5b58<\/h3>\n<p>\u5f53\u793e\u306f\u3001\u5f15\u304d\u7d9a\u304d\u30de\u30eb\u30c1\u30d7\u30e9\u30c3\u30c8\u30d5\u30a9\u30fc\u30e0\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u8a2d\u5b9a\u30d7\u30ed\u30bb\u30b9\u306e\u958b\u767a\u306b\u53d6\u308a\u7d44\u3093\u3067\u3044\u307e\u3059\u3002 1.5.0 \u3067\u306f\u3001\u3042\u3089\u3086\u308b\u30bd\u30fc\u30b9\u30bb\u30c3\u30c8\u306b\u304a\u3051\u308b <code>kotlin-test<\/code> \u3078\u306e\u4f9d\u5b58\u95a2\u4fc2\u3092\u7c21\u5358\u306b\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u4eca\u56de\u3001\u30c6\u30b9\u30c8\u7528\u306e\u5171\u901a\u30bd\u30fc\u30b9\u30bb\u30c3\u30c8\u306b <code>kotlin-test<\/code> \u3078\u306e\u4f9d\u5b58\u95a2\u4fc2\u3092\u8ffd\u52a0\u3059\u308b\u3060\u3051\u3067\u3088\u304f\u306a\u308a\u307e\u3057\u305f\u3002 \u4ed6\u306e\u30bd\u30fc\u30b9\u30bb\u30c3\u30c8\u306b\u5bfe\u5fdc\u3059\u308b\u30d7\u30e9\u30c3\u30c8\u30d5\u30a9\u30fc\u30e0\u306e\u4f9d\u5b58\u306b\u3064\u3044\u3066\u306f\u3001Gradle \u30d7\u30e9\u30b0\u30a4\u30f3\u304c\u63a8\u8ad6\u3057\u3066\u304f\u308c\u307e\u3059\u3002<\/p>\n<ul>\n<li>JVM \u30bd\u30fc\u30b9\u30bb\u30c3\u30c8\u7528 <code>kotlin-test-junit<\/code>\u3002 \u660e\u793a\u7684\u306b\u6709\u52b9\u5316\u3059\u308c\u3070\u3001<code>kotlin-test-junit-5<\/code> \u3084 <code>kotlin-test-testng<\/code> \u306b\u5207\u308a\u66ff\u3048\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059 (\u305d\u306e\u65b9\u6cd5\u306f\u5f8c\u307b\u3069\u8aac\u660e\u3057\u307e\u3059)\u3002<\/li>\n<li>Kotlin\/JS \u30bd\u30fc\u30b9\u30bb\u30c3\u30c8\u7528 <code>kotlin-test-js<\/code>\u3002<\/li>\n<li>\u5171\u901a\u30bd\u30fc\u30b9\u30bb\u30c3\u30c8\u7528 <code>kotlin-test-common<\/code> \u304a\u3088\u3073 <code>kotlin-test-annotations-common<\/code>\u3002<\/li>\n<li>Kotlin\/Native \u306b\u306f\u3042\u3089\u304b\u3058\u3081 <code>kotlin-test<\/code> API \u304c\u5b9f\u88c5\u3055\u308c\u3066\u3044\u308b\u305f\u3081\u3001Kotlin\/Native \u30bd\u30fc\u30b9\u30bb\u30c3\u30c8\u306b\u5225\u306e\u30a2\u30fc\u30c6\u30a3\u30d5\u30a1\u30af\u30c8\u306f\u7528\u610f\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002<\/li>\n<\/ul>\n<h3>Kotlin\/JVM \u30bd\u30fc\u30b9\u30bb\u30c3\u30c8\u7528\u30c6\u30b9\u30c8\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u306e\u81ea\u52d5\u9078\u629e<\/h3>\n<p>\u4e0a\u8ff0\u3057\u305f\u3068\u304a\u308a\u306b\u3001\u30c6\u30b9\u30c8\u7528\u306e\u5171\u901a\u30bd\u30fc\u30b9\u30bb\u30c3\u30c8\u306b <code>kotlin-test<\/code> \u3078\u306e\u4f9d\u5b58\u95a2\u4fc2\u3092\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u3057\u305f\u3089\u3001JUnit 4 \u3067 JVM \u30bd\u30fc\u30b9\u30bb\u30c3\u30c8\u306e\u4f9d\u5b58\u95a2\u4fc2\u304c\u81ea\u52d5\u7684\u306b\u8a2d\u5b9a\u3055\u308c\u307e\u3059\u3002 \u4ee5\u4e0a\u3067\u3059\uff01\u3000 \u30c6\u30b9\u30c8\u30b3\u30fc\u30c9\u3092\u66f8\u3044\u3066\u3059\u3050\u306b\u5b9f\u884c\u3067\u304d\u307e\u3059\uff01<\/p>\n<p>Groovy DSL \u3067\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30b3\u30fc\u30c9\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p><pre class=\"kotlin-code\" data-highlight-only=\"true\" theme=\"idea\" indent=\"4\" style=\"visibility: hidden; padding: 36px 0;\">\r\nkotlin {\r\n    sourceSets {\r\n        commonTest {\r\n            dependencies {\r\n                 \/\/ This brings the dependency\r\n                \/\/ on JUnit 4 transitively\r\n                implementation kotlin(&#039;test&#039;)\r\n            }\r\n        }\r\n    }\r\n}\r\n<\/pre>\n<\/p>\n<p>Kotlin DSL \u306e\u5834\u5408\u306f\u3053\u3046\u306a\u308a\u307e\u3059\u3002<\/p>\n<p><pre class=\"kotlin-code\" data-highlight-only=\"true\" theme=\"idea\" indent=\"4\" style=\"visibility: hidden; padding: 36px 0;\">\r\nkotlin {\r\n    sourceSets {\r\n        val commonTest by getting {\r\n            dependencies {\r\n                \/\/ This brings the dependency\r\n                \/\/ on JUnit 4 transitively\r\n                implementation(kotlin(&quot;test&quot;))\r\n            }\r\n        }\r\n    }\r\n}\r\n<\/pre>\n<\/p>\n<p>\u30c6\u30b9\u30c8\u30bf\u30b9\u30af\u5185\u3067 <a href=\"https:\/\/docs.gradle.org\/current\/javadoc\/org\/gradle\/api\/tasks\/testing\/Test.html#useJUnitPlatform--\" target=\"_blank\" rel=\"noopener\"><code>useJUnitPlatform()<\/code><\/a> \u304b <a href=\"https:\/\/docs.gradle.org\/current\/javadoc\/org\/gradle\/api\/tasks\/testing\/Test.html#useTestNG--\" target=\"_blank\" rel=\"noopener\"><code>useTestNG()<\/code><\/a> \u3092\u547c\u3073\u51fa\u305b\u3070\u3001\u305d\u308c\u305e\u308c JUnit 5 \u307e\u305f\u306f TestNG \u306b\u5207\u308a\u66ff\u3048\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"kotlin-code\" data-highlight-only=\"true\" theme=\"idea\" indent=\"4\" style=\"visibility: hidden; padding: 36px 0;\">\r\nkotlin {\r\n    jvm {\r\n        testRuns[&quot;test&quot;].executionTask.configure {\r\n            \/\/ enable TestNG support\r\n            useTestNG()\r\n            \/\/ or\r\n            \/\/ enable JUnit Platform (a.k.a. JUnit 5) support\r\n            useJUnitPlatform()\r\n        }\r\n    }\r\n}\r\n<\/pre>\n<\/p>\n<p><code>kotlin-test<\/code> \u3078\u306e\u4f9d\u5b58\u95a2\u4fc2\u3092\u8ffd\u52a0\u3059\u308c\u3070\u3001JVM \u306e\u307f\u4f7f\u7528\u3059\u308b\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3067\u3082\u540c\u3058\u3053\u3068\u3092\u884c\u3048\u307e\u3059\u3002<\/p>\n<h3>\u30a2\u30b5\u30fc\u30b7\u30e7\u30f3\u95a2\u6570\u306e\u66f4\u65b0<\/h3>\n<p>1.5.0 \u3067\u306f\u3001\u65b0\u3057\u3044\u30a2\u30b5\u30fc\u30b7\u30e7\u30f3\u95a2\u6570\u3092\u3044\u304f\u3064\u304b\u4f5c\u6210\u3057\u3001\u65e2\u5b58\u306e\u95a2\u6570\u306b\u6539\u5584\u3092\u52a0\u3048\u307e\u3057\u305f\u3002<\/p>\n<p>\u305d\u308c\u3067\u306f\u3001\u307e\u305a\u65b0\u3057\u3044\u95a2\u6570\u3092\u3055\u3063\u3068\u898b\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<ul>\n<li><code>assertIs&lt;T&gt;()<\/code> \u3068 <code>assertIsNot&lt;T&gt;()<\/code> \u306f\u5024\u306e\u578b\u3092\u30c1\u30a7\u30c3\u30af\u3057\u307e\u3059\u3002<\/li>\n<li><code>assertContentEquals()<\/code> \u306f\u914d\u5217\u3001\u30b7\u30fc\u30b1\u30f3\u30b9\u3001<code>Iterable<\/code> \u306e\u4e2d\u8eab\u3092\u6bd4\u8f03\u3057\u307e\u3059\u3002 \u3088\u308a\u6b63\u78ba\u306b\u306f\u3001<code>expected<\/code> \u3068 <code>actual<\/code> \u306b\u540c\u3058\u8981\u7d20\u304c\u540c\u3058\u9806\u756a\u3067\u683c\u7d0d\u3055\u308c\u3066\u3044\u308b\u304b\u3069\u3046\u304b\u3092\u30c1\u30a7\u30c3\u30af\u3057\u307e\u3059\u3002<\/li>\n<li><code>assertEquals()<\/code> \u3068 <code>assertNotEquals()<\/code> \u306f\u3001<code>Double<\/code> \u3068 <code>Float<\/code> \u306e\u8981\u7d20\u306b\u5bfe\u3057\u3066\u300cprecision\u300d\uff08\u7cbe\u5ea6\uff09\u3068\u3044\u3046 3 \u3064\u76ee\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u30fc\u3092\u4f7f\u3063\u3066\u30aa\u30fc\u30d0\u30fc\u30ed\u30fc\u30c9\u304c\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/li>\n<li><code>assertContains()<\/code> \u306f\u3001<code>contains()<\/code> \u6f14\u7b97\u5b50 (\u914d\u5217\u3001\u30ea\u30b9\u30c8\u3001\u30ec\u30f3\u30b8\u306a\u3069) \u304c\u5b9a\u7fa9\u3055\u308c\u305f\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u4e2d\u306b\u30a2\u30a4\u30c6\u30e0\u304c\u5b58\u5728\u3059\u308b\u304b\u3069\u3046\u304b\u3092\u30c1\u30a7\u30c3\u30af\u3057\u307e\u3059\u3002<\/li>\n<\/ul>\n<p>\u3053\u3061\u3089\u304c\u3001\u3053\u308c\u3089\u306e\u95a2\u6570\u306e\u7c21\u5358\u306a\u4f7f\u7528\u4f8b\u3067\u3059\u3002<\/p>\n<pre class=\"kotlin-code\" data-highlight-only=\"true\" theme=\"idea\" indent=\"4\" style=\"visibility: hidden; padding: 36px 0;\">\r\n@Test\r\nfun test() {\r\n    val expectedArray = arrayOf(1, 2, 3)\r\n    val actualArray = Array(3) { it + 1 }\r\n    \r\n    val first: Any = actualArray[0]\r\n    assertIs&lt;Int&gt;(first)\r\n    \/\/ first is smart-cast to Int now\r\n    println(&quot;${first + 1}&quot;)\r\n    \r\n    assertContentEquals(expectedArray, actualArray)\r\n    assertContains(expectedArray, 2)\r\n\r\n    val x = sin(PI)\r\n\r\n    \/\/ precision parameter\r\n    val tolerance = 0.000001\r\n\r\n    assertEquals(0.0, x, tolerance)\r\n}\r\n<\/pre>\n<\/p>\n<p>\u65e2\u5b58\u306e\u30a2\u30b5\u30fc\u30b7\u30e7\u30f3\u95a2\u6570\u306b\u3064\u3044\u3066: \u95a2\u6570 <code>assertTrue()<\/code>\u3001<code>assertFalse()<\/code>\u3001<code>expect()<\/code> \u306f\u3059\u3079\u3066<a href=\"https:\/\/kotlinlang.org\/docs\/inline-functions.html\" target=\"_blank\" rel=\"noopener\">\u30a4\u30f3\u30e9\u30a4\u30f3\u5316<\/a>\u3055\u308c\u305f\u305f\u3081\u3001\u305d\u308c\u3089\u306b\u6e21\u3055\u308c\u308b\u30e9\u30e0\u30c0\u306e\u4e2d\u3067<a href=\"https:\/\/kotlinlang.org\/docs\/composing-suspending-functions.html\" target=\"_blank\" rel=\"noopener\">\u30b5\u30b9\u30da\u30f3\u30c9\u95a2\u6570<\/a>\u3092\u547c\u3073\u51fa\u305b\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<h2>Kotlin 1.5.0 \u306e\u5168\u6a5f\u80fd\u3092\u304a\u8a66\u3057\u304f\u3060\u3055\u3044<\/h2>\n<p>1.5.0-RC \u3067 Kotlin \u306e\u6700\u65b0 API \u306e\u3059\u3079\u3066\u3092\u5b9f\u969b\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3067\u6d3b\u7528\u3057\u307e\u3057\u3087\u3046\uff01<\/p>\n<p>IntelliJ IDEA \u304b Android Studio \u306e\u3069\u3061\u3089\u304b\u3067\u3001Kotlin \u30d7\u30e9\u30b0\u30a4\u30f3 1.5.0-RC \u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u304f\u3060\u3055\u3044\u3002 <a href=\"https:\/\/kotlinlang.org\/docs\/install-eap-plugin.html\" target=\"_blank\" rel=\"noopener\">EAP \u30d7\u30e9\u30b0\u30a4\u30f3\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u53d6\u5f97\u3059\u308b\u65b9\u6cd5<\/a>\u3092\u898b\u308b\u3002<\/p>\n<p>\u65e2\u5b58\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092 1.5.0-RC \u3067\u69cb\u7bc9\u3057\u30011.5.0 \u3067\u306e\u52d5\u4f5c\u3092\u78ba\u8a8d\u3057\u307e\u3057\u3087\u3046\u3002 <a href=\"https:\/\/blog.jetbrains.com\/kotlin\/2021\/03\/kotlin-1-5-0-m2-released\/\">\u30d7\u30ec\u30d3\u30e5\u30fc\u30ea\u30ea\u30fc\u30b9\u7528\u306b\u7c21\u7d20\u5316\u3055\u308c\u305f\u65b0\u3057\u3044\u69cb\u6210<\/a>\u3067\u306f\u3001Kotlin \u30d0\u30fc\u30b8\u30e7\u30f3\u3092 <code>1.5.0-RC<\/code> \u306b\u5909\u66f4\u3057\u3001\u5fc5\u8981\u306b\u5fdc\u3058\u3066<a href=\"https:\/\/kotlinlang.org\/docs\/eap.html#build-details\" target=\"_blank\" rel=\"noopener\">\u4f9d\u5b58\u95a2\u4fc2\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u8abf\u6574<\/a>\u3059\u308b\u3060\u3051\u3067 OK \u3067\u3059\u3002<\/p>\n<p align=\"center\"><a class=\"jb-download-button\" title=\"\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\" href=\"https:\/\/kotlinlang.org\/docs\/install-eap-plugin.html\" target=\"_blank\" rel=\"noopener\">1.5.0-RC \u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/a><\/p>\n<p>\u3044\u3064\u3082\u306e\u3088\u3046\u306b\u3001\u6700\u65b0\u30d0\u30fc\u30b8\u30e7\u30f3\u306f <a href=\"https:\/\/play.kotlinlang.org\" target=\"_blank\" rel=\"noopener\">Kotlin Playground<\/a> \u304b\u3089\u30aa\u30f3\u30e9\u30a4\u30f3\u3067\u304a\u8a66\u3057\u3044\u305f\u3060\u3051\u307e\u3059\u3002<\/p>\n<h2>\u4e92\u63db\u6027<\/h2>\n<p>\u3059\u3079\u3066\u306e\u6a5f\u80fd\u30ea\u30ea\u30fc\u30b9\u3068\u540c\u69d8\u306b\u3001Kotlin 1.5.0 \u3092\u4ee5\u3066\u3001\u4ee5\u524d\u306b\u767a\u8868\u3057\u305f\u5909\u66f4\u306e\u4f7f\u7528\u5ec3\u6b62\u30b5\u30a4\u30af\u30eb\u304c\u4e00\u90e8\u7d42\u4e86\u3092\u8fce\u3048\u307e\u3059\u3002 \u3059\u3079\u3066\u306e\u30b1\u30fc\u30b9\u306f\u8a00\u8a9e\u59d4\u54e1\u4f1a\u306b\u3088\u308b\u5341\u5206\u306a\u691c\u8a0e\u306e\u5f8c\u3001\u300c<a href=\"https:\/\/kotlinlang.org\/docs\/compatibility-guide-15.html\" target=\"_blank\" rel=\"noopener\">Kotlin 1.5 \u306e\u4e92\u63db\u6027\u30ac\u30a4\u30c9<\/a>\u300d\u306b\u8a18\u8f09\u3055\u308c\u3066\u3044\u307e\u3059\u3002 \u307e\u305f\u3001<a href=\"https:\/\/youtrack.jetbrains.com\/issues\/KT?q=Tag:%20language-committee-approved%20Target%20versions:%201.5.0-RC,%201.5.0-M2,%201.5.0-M1,%201.5.0\" target=\"_blank\" rel=\"noopener\">YouTrack<\/a> \u3067\u3082\u5909\u66f4\u5185\u5bb9\u3092\u78ba\u8a8d\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<h3>\u30ea\u30ea\u30fc\u30b9\u5019\u88dc\u30ce\u30fc\u30c8<\/h3>\n<p>Kotlin 1.5.0 \u306e\u30ea\u30ea\u30fc\u30b9\u5019\u88dc\u3092\u7d39\u4ecb\u3057\u305f\u3068\u3053\u308d\u3067\u3001\u4eca\u5ea6\u306f\u7686\u3055\u3093\u304c\u30b3\u30f3\u30d1\u30a4\u30eb\u3068\u516c\u958b\u3092\u884c\u3046\u756a\u3067\u3059\uff01 \u524d\u56de\u306e\u30de\u30a4\u30eb\u30b9\u30c8\u30fc\u30f3\u30ea\u30ea\u30fc\u30b9\u3068\u306f\u7570\u306a\u308a\u3001Kotlin 1.5.0-RC \u3067\u4f5c\u6210\u3055\u308c\u305f\u30d0\u30a4\u30ca\u30ea\u30fc\u306f\u3001Kotlin 1.5.0 \u3068\u306e\u4e92\u63db\u6027\u304c\u4fdd\u8a3c\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<h2>\u3054\u610f\u898b\u3092\u304a\u5bc4\u305b\u304f\u3060\u3055\u3044<\/h2>\n<p>\u3053\u308c\u304c\u6b21\u306e\u6a5f\u80fd\u30ea\u30ea\u30fc\u30b9\u306b\u8ca2\u732e\u3059\u308b\u6700\u5f8c\u306e\u30c1\u30e3\u30f3\u30b9\u3067\u3059\uff01 \u554f\u984c\u3092\u767a\u898b\u3055\u308c\u307e\u3057\u305f\u3089\u3001\u5f53\u793e\u306e<a href=\"https:\/\/kotl.in\/issue\" target=\"_blank\" rel=\"noopener\">\u8ab2\u984c\u30c8\u30e9\u30c3\u30ab\u30fc<\/a>\u306b\u3066\u304a\u77e5\u3089\u305b\u304f\u3060\u3055\u3044\u3002 \u30b3\u30df\u30e5\u30cb\u30c6\u30a3\u5168\u4f53\u306e\u305f\u3081\u306b Kotlin 1.5.0 \u3092\u6539\u5584\u3057\u307e\u3057\u3087\u3046\uff01<\/p>\n<p align=\"center\"><a class=\"jb-download-button\" title=\"\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\" href=\"https:\/\/kotlinlang.org\/docs\/install-eap-plugin.html\" target=\"_blank\" rel=\"noopener\">1.5.0-RC \u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/a><\/p>\n","protected":false},"author":811,"featured_media":136574,"comment_status":"closed","ping_status":"closed","template":"","categories":[907],"tags":[],"cross-post-tag":[],"acf":[],"_links":{"self":[{"href":"https:\/\/blog.jetbrains.com\/ja\/wp-json\/wp\/v2\/kotlin\/138452"}],"collection":[{"href":"https:\/\/blog.jetbrains.com\/ja\/wp-json\/wp\/v2\/kotlin"}],"about":[{"href":"https:\/\/blog.jetbrains.com\/ja\/wp-json\/wp\/v2\/types\/kotlin"}],"author":[{"embeddable":true,"href":"https:\/\/blog.jetbrains.com\/ja\/wp-json\/wp\/v2\/users\/811"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.jetbrains.com\/ja\/wp-json\/wp\/v2\/comments?post=138452"}],"version-history":[{"count":8,"href":"https:\/\/blog.jetbrains.com\/ja\/wp-json\/wp\/v2\/kotlin\/138452\/revisions"}],"predecessor-version":[{"id":138480,"href":"https:\/\/blog.jetbrains.com\/ja\/wp-json\/wp\/v2\/kotlin\/138452\/revisions\/138480"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.jetbrains.com\/ja\/wp-json\/wp\/v2\/media\/136574"}],"wp:attachment":[{"href":"https:\/\/blog.jetbrains.com\/ja\/wp-json\/wp\/v2\/media?parent=138452"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.jetbrains.com\/ja\/wp-json\/wp\/v2\/categories?post=138452"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.jetbrains.com\/ja\/wp-json\/wp\/v2\/tags?post=138452"},{"taxonomy":"cross-post-tag","embeddable":true,"href":"https:\/\/blog.jetbrains.com\/ja\/wp-json\/wp\/v2\/cross-post-tag?post=138452"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}