{"id":22864,"date":"2020-12-24T09:00:46","date_gmt":"2020-12-24T00:00:46","guid":{"rendered":"https:\/\/mole-kingdom.com\/wpbl\/?p=22864"},"modified":"2020-12-28T23:04:13","modified_gmt":"2020-12-28T14:04:13","slug":"%e6%bc%94%e7%ae%97%e5%ad%90%e3%81%ae%e3%82%aa%e3%83%bc%e3%83%90%e3%83%bc%e3%83%ad%e3%83%bc%e3%83%89-kotlin","status":"publish","type":"post","link":"https:\/\/mole-kingdom.com\/wpbl\/2020\/12\/24\/22864.html","title":{"rendered":"\u6f14\u7b97\u5b50\u306e\u30aa\u30fc\u30d0\u30fc\u30ed\u30fc\u30c9: kotlin"},"content":{"rendered":"<p class=\"outline01\"><a href=\"https:\/\/kotlinlang.org\/docs\/reference\/operator-overloading.html\" rel=\"noopener\" target=\"_blank\">\u6f14\u7b97\u5b50\u306e\u30aa\u30fc\u30d0\u30fc\u30ed\u30fc\u30c9<\/a><\/p>\n<p>Kotlin\u3067\u306f\u4f5c\u6210\u3059\u308b\u578b\u306b\u5bfe\u3057\u3066\u3001\u4e8b\u524d\u5b9a\u7fa9\u6e08\u3067\u3042\u308b\u6f14\u7b97\u5b50\u30bb\u30c3\u30c8\u306e\u30aa\u30fc\u30d0\u30fc\u30ed\u30fc\u30c9\u5b9f\u88c5\u3092\u63d0\u4f9b\u3067\u304d\u307e\u3059\u3002\u3053\u308c\u3089\u306e\u6f14\u7b97\u5b50\u306f\u56fa\u5b9a\u306e\u8a18\u53f7\u8868\u73fe(+\u3084*\u306a\u3069)\u3068\u56fa\u5b9a\u306e\u512a\u5148\u9806\u4f4d\u3092\u6301\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u6f14\u7b97\u5b50\u3092\u30aa\u30fc\u30d0\u30fc\u30ed\u30fc\u30c9\u5b9f\u88c5\u3059\u308b\u306b\u306f\u3001\u8a72\u5f53\u3059\u308b\u578b(\u4e8c\u9805\u6f14\u7b97\u6642\u306e\u5de6\u5074\u306e\u578b\u3084\u5358\u9805\u6f14\u7b97\u6642\u306e\u5f15\u6570\u306e\u578b)\u306b\u5bfe\u3057\u3066\u65e2\u5b9a\u306e\u540d\u524d\u3092\u6301\u3064\u30e1\u30f3\u30d0\u95a2\u6570\u307e\u305f\u306f\u62e1\u5f35\u95a2\u6570\u3092\u7528\u610f\u3057\u307e\u3059\u3002<\/p>\n<p>\u3053\u306e\u6f14\u7b97\u5b50\u3092\u30aa\u30fc\u30d0\u30fc\u30ed\u30fc\u30c9\u3059\u308b\u95a2\u6570\u306foperator\u4fee\u98fe\u5b50\u3092\u4ed8\u52a0\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059<\/p>\n<p><span class=\"f_s\">\u203b\u4e00\u6587\u76ee\u304b\u3089\u8d85\u8a33\u3092\u767a\u52d5\u3057\u3066\u3057\u307e\u3063\u305f(\uff89\u2200`)<br \/>\n\"Kotlin allows us to provide implementations for a predefined set of operators on our types.\"\u306e\"our type\"\u3092\u3001\u4e3b\u8a9e\u304c\"Kotlin\"\u3067\u3042\u308a\u3001\u6211\u3005(\u30d7\u30ed\u30b0\u30e9\u30de\u5074)\u306e\u578b\u3068\u8868\u73fe\u3057\u3066\u3044\u308b\u3053\u3068\u304b\u3089\"(\u30d7\u30ed\u30b0\u30e9\u30de\u304c)\u4f5c\u6210\u3059\u308b\u578b\"\u3068\u3057\u305f\u304c\u3001Kotlin\u304c\u5b9a\u7fa9\u3057\u3066\u3044\u308b\u5168\u3066\u306e\u578b\u3067\u6f14\u7b97\u5b50\u30aa\u30fc\u30d0\u30fc\u30ed\u30fc\u30c9\u304c\u51fa\u6765\u308b\u306a\u3089\"\u4efb\u610f\u306e\u578b\"\u3068\u3059\u3079\u304d\u304b\uff1f<\/span><\/p>\n<p>\u3055\u3089\u306b\u3001\u3055\u307e\u3056\u307e\u306a\u6f14\u7b97\u5b50\u306e\u6f14\u7b97\u5b50\u306e\u30aa\u30fc\u30d0\u30fc\u30ed\u30fc\u30c9\u3092\u5236\u9650\u3059\u308b\u898f\u7d04\u306b\u3064\u3044\u3066\u8aac\u660e\u3057\u307e\u3059\u3002<\/p>\n<hr>\n<p class=\"outline02\">\u5358\u9805\u6f14\u7b97<\/p>\n<p><\/p>\n<p class=\"outline03\">\u5358\u9805\u63a5\u982d\u6f14\u7b97\u5b50<\/p>\n<table>\n<thead>\n<tr>\n<th>\u5f0f<\/th>\n<th>\u5bfe\u5fdc\u3059\u308b\u95a2\u6570<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>+a<\/code><\/td>\n<td><code>a.unaryPlus()<\/code><\/td>\n<\/tr>\n<tr>\n<td><code>-a<\/code><\/td>\n<td><code>a.unaryMinus()<\/code><\/td>\n<\/tr>\n<tr>\n<td><code>!a<\/code><\/td>\n<td><code>a.not()<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u3053\u306e\u8868\u306f\u3001\u30b3\u30f3\u30d1\u30a4\u30e9\u304c\u305f\u3068\u3048\u3070\u5f0f +a \u3092\u51e6\u7406\u3059\u308b\u6642\u306b\u4ee5\u4e0b\u306e\u624b\u9806\u3092\u5b9f\u884c\u3059\u308b\u3053\u3068\u3092\u793a\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>- a\u306e\u578b\u3092\u6c7a\u5b9a\u3057\u307e\u3059\u3002T\u3068\u3057\u307e\u3059\u3002<\/p>\n<p>- operator\u4fee\u98fe\u5b50\u304c\u3042\u308a\u3001\u5f15\u6570\u304c\u306a\u3044\u30ec\u30b7\u30fc\u30d0T\u7528\u306e\u95a2\u6570 unaryPlus()(\u5373\u3061\u30e1\u30f3\u30d0\u30fc\u95a2\u6570\u307e\u305f\u306f\u62e1\u5f35\u95a2\u6570)\u3092\u691c\u7d22\u3057\u307e\u3059\u3002<\/p>\n<p>- \u95a2\u6570\u304c\u5b58\u5728\u3057\u306a\u3044\u304b\u3042\u3044\u307e\u3044\u306a\u5834\u5408\u306f\u3001\u30b3\u30f3\u30d1\u30a4\u30eb\u30a8\u30e9\u30fc\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>- \u95a2\u6570\u304c\u5b58\u5728\u3057\u3001\u305d\u306e\u623b\u308a\u5024\u306e\u578b\u304cR\u3067\u3042\u308b\u5834\u5408\u3001\u5f0f+a\u306e\u578b\u306fR\u3067\u3059\u3002<\/p>\n<p>\u3053\u308c\u3089\u306e\u6f14\u7b97\u306f\u4ed6\u306e\u3059\u3079\u3066\u306e\u6f14\u7b97\u3068\u540c\u69d8\u306b\u57fa\u672c\u578b\u7528\u306b\u6700\u9069\u5316\u3055\u308c\u3066\u304a\u308a\u3001\u305d\u306e\u95a2\u6570\u547c\u3073\u51fa\u3057\u306e\u30aa\u30fc\u30d0\u30fc\u30d8\u30c3\u30c9\u3092\u767a\u751f\u3055\u305b\u306a\u3044\u3053\u3068\u306b\u7559\u610f\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u4e00\u4f8b\u3068\u3057\u3066\u3001\u5358\u9805\u30de\u30a4\u30ca\u30b9\u6f14\u7b97\u5b50\u3092\u30aa\u30fc\u30d0\u30fc\u30ed\u30fc\u30c9\u3059\u308b\u65b9\u6cd5\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3067\u3059\u3002:<\/p>\n<pre class=\"brush: kotlin; title: ; notranslate\" title=\"\">\r\ndata class Point(val x: Int, val y: Int)\r\n\u200b\r\noperator fun Point.unaryMinus() = Point(-x, -y)\r\n\u200b\r\nval point = Point(10, 20)\r\n\u200b\r\nfun main() {\r\n   println(-point)  \/\/ &quot;Point(x=-10, y=-20)&quot;\u3092\u51fa\u529b\u3057\u307e\u3059\u3002\r\n}\r\n<\/pre>\n<hr width=\"90%\">\n<p class=\"outline03\">\u30a4\u30f3\u30af\u30ea\u30e1\u30f3\u30c8\u53ca\u3073\u30c7\u30af\u30ea\u30e1\u30f3\u30c8<\/p>\n<p><span class=\"f_s\"><del datetime=\"2020-12-28T14:00:20+00:00\">\u203b\u3088\u304f\u308f\u304b\u3089\u306a\u3044\u304c\u3001\"-\"\u30922\u3064\u4e26\u3079\u3066\u8a18\u8ff0\u3059\u308b\u30681\u3064\u3057\u304b\u8868\u793a\u3055\u308c\u306a\u3044\uff1f<br \/>\nwordpress\u304b\u30d7\u30e9\u30b0\u30a4\u30f3\u306b\u3088\u3063\u3066\u307e\u3068\u3081\u3089\u308c\u3066\u7f6b\u7dda\u6271\u3044\u306b\u306a\u3063\u3066\u3044\u308b\uff1f \u53d6\u308a\u6562\u3048\u305a&lt;code&gt;\u30bf\u30b0\u3067\u56f2\u3093\u3060\u304c\u2026<br \/>\n----- \u2190\u30bd\u30fc\u30b9\u3060\u3068\"-\"x5<\/del><\/span><br \/>\n<span class=\"f_s\">\u203bwptexturize\u306e\u6240\u70ba\u3060\u3063\u305f(\uff89\u2200`) <a href=\"https:\/\/moondoldo.com\/wordpress\/?p=5913\" rel=\"noopener\" target=\"_blank\">WordPress\u3067\u4e00\u90e8\u306e\u6587\u5b57\u304c\u52dd\u624b\u306b\u7f6e\u63db\u3055\u308c\u308b\u306e\u3092\u7121\u52b9\u5316(123x456\u2192123\u00d7456\u3068\u304b)<\/a><\/span><\/p>\n<table class=\"typo-table\">\n<thead>\n<tr>\n<th>\u5f0f<\/th>\n<th>\u5bfe\u5fdc\u3059\u308b\u95a2\u6570<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>a++<\/code><\/td>\n<td><code>a.inc()<\/code> + \u4ee5\u4e0b\u3092\u53c2\u7167<\/td>\n<\/tr>\n<tr>\n<td><code>a--<\/code><\/td>\n<td><code>a.dec()<\/code> + \u4ee5\u4e0b\u3092\u53c2\u7167<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>inc()\u304a\u3088\u3073dec()\u95a2\u6570\u306f\u5024\u3092\u8fd4\u3059\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u3053\u306e\u5024\u306f++\u6f14\u7b97\u307e\u305f\u306f--\u6f14\u7b97\u3067\u4f7f\u7528\u3055\u308c\u305f\u5909\u6570\u306b\u5272\u308a\u5f53\u3066\u3089\u308c\u307e\u3059\u3002inc\u307e\u305f\u306fdec\u306f\u81ea\u8eab\u3092\u547c\u3073\u51fa\u3057\u305f\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u5909\u66f4\u3057\u3066\u306f\u306a\u308a\u307e\u305b\u3093\u3002<\/p>\n<p>\u30b3\u30f3\u30d1\u30a4\u30e9\u306f\u5f8c\u7f6e\u5f62\u5f0f\u306e\u6f14\u7b97\u5b50(\u4f8b\u3048\u3070a++)\u3092\u51e6\u7406\u3059\u308b\u305f\u3081\u306b\u4ee5\u4e0b\u306e\u624b\u9806\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002\uff1a<\/p>\n<p>- a\u306e\u578b\u3092\u6c7a\u5b9a\u3057\u307e\u3059\u3002T\u3068\u3057\u307e\u3059\u3002<\/p>\n<p>- \u578bT\u306e\u30ec\u30b7\u30fc\u30d0\u306b\u9069\u7528\u53ef\u80fd\u306a\u3001operator\u4fee\u98fe\u5b50\u304c\u3042\u308a\u3001\u5f15\u6570\u304c\u306a\u3044<br \/>\n\u95a2\u6570inc()(\u5373\u3061\u30e1\u30f3\u30d0\u30fc\u95a2\u6570\u307e\u305f\u306f\u62e1\u5f35\u95a2\u6570)\u3092\u691c\u7d22\u3057\u307e\u3059\u3002;<\/p>\n<p>- \u95a2\u6570\u306e\u623b\u308a\u5024\u306e\u578b\u304cT\u306e\u30b5\u30d6\u578b\u3067\u3042\u308b\u3053\u3068\u3092\u5224\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<p>\u5f0f\u3092\u8a08\u7b97\u3059\u308b\u3053\u3068\u306b\u3088\u308b\u4f5c\u7528\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3067\u3059\u3002<\/p>\n<p>- a\u306e\u521d\u671f\u5024\u3092\u4e00\u6642\u4fdd\u5b58\u306e a0\u306b\u683c\u7d0d\u3057\u307e\u3059\u3002<\/p>\n<p>- a0.inc()\u306e\u7d50\u679c\u3092a\u306b\u5272\u308a\u5f53\u3066\u307e\u3059\u3002<\/p>\n<p>- \u5f0f\u306e\u7d50\u679c\u3068\u3057\u3066a0\u3092\u8fd4\u3057\u307e\u3059\u3002<span class=\"f_s\">\u203b\u5f8c\u7f6e\u30a4\u30f3\u30af\u30ea\u306a\u306e\u3067a\u306e\u521d\u671f\u5024\u3092\u8fd4\u3057\u3066\u3044\u308b\u3002<\/span><\/p>\n<p><code>a--<\/code>\u306e\u5834\u5408\u3067\u306f\u51e6\u7406\u306f\u5b8c\u5168\u306b\u985e\u4f3c\u3057\u3066\u3044\u307e\u3059<\/p>\n<p>\u524d\u7f6e\u5f62\u5f0f ++a\u304a\u3088\u3073<code>a--<\/code>\u306e\u5834\u5408\u306b\u306f\u51e6\u7406\u306f\u540c\u3058\u3088\u3046\u306b\u6a5f\u80fd\u3057\u3001\u4f5c\u7528\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3067\u3059\u3002:<\/p>\n<p>\uff0d a.inc()\u306e\u7d50\u679c\u3092a\u306b\u5272\u308a\u5f53\u3066\u307e\u3059\u3002<\/p>\n<p>\uff0d \u5f0f\u306e\u7d50\u679c\u3068\u3057\u3066\u3001a\u306e\u65b0\u3057\u3044\u5024\u3092\u8fd4\u3057\u307e\u3059\u3002<\/p>\n<hr>\n<p class=\"outline02\">\u4e8c\u9805\u6f14\u7b97<\/p>\n<p><\/p>\n<p class=\"outline03\">\u7b97\u8853\u6f14\u7b97\u5b50<\/p>\n<table>\n<thead>\n<tr\">\n<th>\u5f0f<\/th>\n<th>\u5bfe\u5fdc\u3059\u308b\u95a2\u6570<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>a + b<\/code><\/td>\n<td><code>a.plus(b)<\/code><\/td>\n<\/tr>\n<tr>\n<td><code>a - b<\/code><\/td>\n<td><code>a.minus(b)<\/code><\/td>\n<\/tr>\n<tr>\n<td><code>a * b<\/code><\/td>\n<td><code>a.times(b)<\/code><\/td>\n<\/tr>\n<tr>\n<td><code>a \/ b<\/code><\/td>\n<td><code>a.div(b)<\/code><\/td>\n<\/tr>\n<tr>\n<td><code>a % b<\/code><\/td>\n<td><code>a.rem(b)<\/code>, <code>a.mod(b)<\/code> (\u975e\u63a8\u5968)<\/td>\n<\/tr>\n<tr>\n<td><code>a..b <\/code><\/td>\n<td><code>a.rangeTo(b)<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u3053\u306e\u8868\u306e\u6f14\u7b97\u306e\u5834\u5408\u3001\u30b3\u30f3\u30d1\u30a4\u30e9\u30fc\u306f\u300c\u5bfe\u5fdc\u3059\u308b\u95a2\u6570\u300d\u5217\u306e\u5f0f\u3092\u51e6\u7406\u3059\u308b\u3060\u3051\u3067\u3059\u3002<\/p>\n<p>Kotlin 1.1\u4ee5\u964d\u3001rem\u6f14\u7b97\u5b50\u304c\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u3066\u3044\u308b\u3053\u3068\u306b\u6ce8\u610f\u3057\u3066\u304f\u3060\u3055\u3044\u3002Kotlin 1.0\u306f\u3001Kotlin1.1\u3067\u975e\u63a8\u5968\u3068\u306a\u3063\u305fmod\u6f14\u7b97\u5b50\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002<\/p>\n<p><b>\u4f8b<\/b><br \/>\n\u4ee5\u4e0b\u306f\u3001\u6307\u5b9a\u3055\u308c\u305f\u5024\u3067\u59cb\u307e\u308a\u3001\u30aa\u30fc\u30d0\u30fc\u30ed\u30fc\u30c9\u3055\u308c\u305f+\u6f14\u7b97\u5b50\u3092\u4f7f\u7528\u3057\u3066\u30a4\u30f3\u30af\u30ea\u30e1\u30f3\u30c8\u3067\u304d\u308bCounter\u30af\u30e9\u30b9\u306e\u4f8b\u3067\u3059\u3002:<\/p>\n<pre class=\"brush: kotlin; title: ; notranslate\" title=\"\">\r\ndata class Counter(val dayIndex: Int) {\r\n    operator fun plus(increment: Int): Counter {\r\n        return Counter(dayIndex + increment)\r\n    }\r\n}\r\n<\/pre>\n<hr width=\"90%\">\n<p class=\"outline03\">'In' \u6f14\u7b97\u5b50<\/p>\n<table class=\"typo-table\">\n<thead>\n<tr>\n<th>\u5f0f<\/th>\n<th>\u5bfe\u5fdc\u3059\u308b\u95a2\u6570<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>a in b<\/code><\/td>\n<td><code>b.contains(a)<\/code><\/td>\n<\/tr>\n<tr>\n<td><code>a !in b<\/code><\/td>\n<td><code>!b.contains(a)<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>in\u3068\uff01in\u306e\u51e6\u7406\u904e\u7a0b\u306f\u540c\u3058\u3067\u3059\u304c\u3001\u5f15\u6570\u306e\u9806\u5e8f\u304c\u9006\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002<br \/>\n<span class=\"f_s\">\u203b\u96c6\u56e3\u5074\u3092\u6307\u3059\u5f15\u6570\u306b\u5bfe\u3057\u3066\u95a2\u6570\u5b9a\u7fa9\u3092\u3059\u308b\u3063\u3066\u3053\u3068\u3092\u8a00\u3044\u305f\u3044\u306e\u304b\u306a\uff1f<\/span><\/p>\n<hr width=\"90%\">\n<p class=\"outline03\">\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u4ed8\u304d\u30a2\u30af\u30bb\u30b9\u6f14\u7b97\u5b50<\/p>\n<table>\n<thead>\n<tr>\n<th>\u5f0f<\/th>\n<th>\u5bfe\u5fdc\u3059\u308b\u95a2\u6570<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>a[i]<\/code><\/td>\n<td><code>a.get(i)<\/code><\/td>\n<\/tr>\n<tr>\n<td><code>a[i, j]<\/code><\/td>\n<td><code>a.get(i, j)<\/code><\/td>\n<\/tr>\n<tr>\n<td><code>a[i_1, ...,  i_n]<\/code><\/td>\n<td><code>a.get(i_1, ...,  i_n)<\/code><\/td>\n<\/tr>\n<tr>\n<td><code>a[i] = b<\/code><\/td>\n<td><code>a.set(i, b)<\/code><\/td>\n<\/tr>\n<tr>\n<td><code>a[i, j] = b<\/code><\/td>\n<td><code>a.set(i, j, b)<\/code><\/td>\n<\/tr>\n<tr>\n<td><code>a[i_1, ...,  i_n] = b<\/code><\/td>\n<td><code>a.set(i_1, ..., i_n, b)<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u89d2\u62ec\u5f27\u306f\u3001\u9069\u5207\u306a\u6570\u306e\u5f15\u6570\u3092\u4f7f\u7528\u3057\u3066get()\u304a\u3088\u3073set()\u306e\u547c\u3073\u51fa\u3057\u306b\u5909\u63db\u3055\u308c\u307e\u3059\u3002<\/p>\n<hr width=\"90%\">\n<p class=\"outline03\">\u547c\u3073\u51fa\u3057\u6f14\u7b97\u5b50<\/p>\n<table>\n<thead>\n<tr>\n<th>\u5f0f<\/th>\n<th>\u5bfe\u5fdc\u3059\u308b\u95a2\u6570<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>a()<\/code><\/td>\n<td><code>a.invoke()<\/code><\/td>\n<\/tr>\n<tr>\n<td><code>a(i)<\/code><\/td>\n<td><code>a.invoke(i)<\/code><\/td>\n<\/tr>\n<tr>\n<td><code>a(i, j)<\/code><\/td>\n<td><code>a.invoke(i, j)<\/code><\/td>\n<\/tr>\n<tr>\n<td><code>a(i_1, ...,  i_n)<\/code><\/td>\n<td><code>a.invoke(i_1, ...,  i_n)<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u62ec\u5f27\u306f\u3001\u9069\u5207\u306a\u6570\u306e\u5f15\u6570\u3092\u4f7f\u7528\u3057\u3066invoke()\u306e\u547c\u3073\u51fa\u3057\u306b\u5909\u63db\u3055\u308c\u307e\u3059\u3002<\/p>\n<hr width=\"90%\">\n<p class=\"outline03\">\u62e1\u5f35\u3055\u308c\u305f\u4ee3\u5165(\u8907\u5408\u4ee3\u5165\u6f14\u7b97\u5b50\uff1f\uff09<\/p>\n<table>\n<thead>\n<tr>\n<th>\u5f0f<\/th>\n<th>\u5bfe\u5fdc\u3059\u308b\u95a2\u6570<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>a += b<\/code><\/td>\n<td><code>a.plusAssign(b)<\/code><\/td>\n<\/tr>\n<tr>\n<td><code>a -= b<\/code><\/td>\n<td><code>a.minusAssign(b)<\/code><\/td>\n<\/tr>\n<tr>\n<td><code>a *= b<\/code><\/td>\n<td><code>a.timesAssign(b)<\/code><\/td>\n<\/tr>\n<tr>\n<td><code>a \/= b<\/code><\/td>\n<td><code>a.divAssign(b)<\/code><\/td>\n<\/tr>\n<tr>\n<td><code>a %= b<\/code><\/td>\n<td><code>a.remAssign(b)<\/code>, <code>a.modAssign(b)<\/code> (\u975e\u63a8\u5968)<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u8907\u5408\u4ee3\u5165\u6f14\u7b97\u306e\u5834\u5408(\u4f8b:a += b)\u3001\u30b3\u30f3\u30d1\u30a4\u30e9\u306f\u4ee5\u4e0b\u306e\u624b\u9806\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002:<\/p>\n<p>\uff0d\u53f3\u6b04\u306e\u95a2\u6570\u304c\u5229\u7528\u3067\u304d\u308b\u5834\u5408<\/p>\n<p>\uff0d\u5bfe\u5fdc\u3059\u308b\u4e8c\u9805\u95a2\u6570(\u4f8b\u3048\u3070plusAssign()\u3067\u3042\u3063\u305f\u3089plus())\u3082\u4f7f\u7528\u3067\u304d\u308b\u5834\u5408\u306f\u3001\u30a8\u30e9\u30fc(\u3042\u3044\u307e\u3044\u3055\uff09\u3092\u5831\u544a\u3057\u307e\u3059\u3002<\/p>\n<p>\u30fc\u623b\u308a\u5024\u306e\u578b\u304cUnit\u3067\u3042\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3057\u3001\u305d\u3046\u3067\u306a\u3044\u5834\u5408\u306f\u30a8\u30e9\u30fc\u3092\u5831\u544a\u3057\u307e\u3059\u3002<\/p>\n<p>\u30fca.plusAssign\uff08b\uff09;\u306e\u30b3\u30fc\u30c9\u3092\u751f\u6210\u3057\u307e\u3059\u3002<\/p>\n<p>\u305d\u308c\u4ee5\u5916\u306e\u5834\u5408\u306f\u3001a = a + b\u306e\u30b3\u30fc\u30c9\u3092\u751f\u6210\u3057\u3088\u3046\u3068\u3057\u307e\u3059\u3002\uff08\u3053\u308c\u306b\u306f\u578b\u30c1\u30a7\u30c3\u30af\u304c\u542b\u307e\u308c\u307e\u3059\u3002a + b\u306e\u578b\u306fa\u306e\u30b5\u30d6\u578b\u3067\u3042\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\uff09<\/p>\n<p>\u6ce8\uff1aKotlin\u3067\u306f\u4ee3\u5165\u306f\u5f0f\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002<\/p>\n<hr width=\"90%\">\n<p class=\"outline03\">\u7b49\u4fa1\u6f14\u7b97\u5b50\u304a\u3088\u3073\u4e0d\u7b49\u5f0f\u6f14\u7b97\u5b50<\/p>\n<table class=\"typo-table\">\n<thead>\n<tr>\n<th>\u5f0f<\/th>\n<th>\u5bfe\u5fdc\u3059\u308b\u95a2\u6570<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>a == b<\/code><\/td>\n<td><code>a?.equals(b) ?: (b === null)<\/code><\/td>\n<\/tr>\n<tr>\n<td><code>a != b<\/code><\/td>\n<td><code>!(a?.equals(b) ?: (b === null))<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u3053\u308c\u3089\u306e\u6f14\u7b97\u5b50\u306f\u3001\u95a2\u6570 equals(other: Any?): Boolean\u3067\u306e\u307f\u6a5f\u80fd\u3057\u307e\u3059\u3002\u3053\u308c\u3092\u30aa\u30fc\u30d0\u30fc\u30e9\u30a4\u30c9\u3057\u3066\u30ab\u30b9\u30bf\u30e0\u306e\u7b49\u4fa1\u6027\u5224\u5b9a\u306e\u5b9f\u88c5\u3092\u63d0\u4f9b\u3067\u304d\u307e\u3059\u3002\u540c\u3058\u540d\u524d\u306e\u4ed6\u306e\u95a2\u6570(equals(other: Foo)\u306a\u3069)\u306f\u547c\u3073\u51fa\u3055\u308c\u307e\u305b\u3093\u3002<\/p>\n<p>\u6ce8\uff1a===\u304a\u3088\u3073\uff01==\uff08\u540c\u4e00\u6027\u5224\u5b9a\uff09\u306f\u30aa\u30fc\u30d0\u30fc\u30ed\u30fc\u30c9\u3067\u304d\u306a\u3044\u305f\u3081\u3001\u3053\u308c\u3089\u306e\u898f\u5247\u306f\u3042\u308a\u307e\u305b\u3093\u3002<\/p>\n<p>==\u6f14\u7b97\u306f\u7279\u5225\u3067\u3059\u3002null\u3092\u6392\u9664\u3059\u308b\u8907\u96d1\u306a\u5f0f\u306b\u5909\u63db\u3055\u308c\u307e\u3059\u3002 null == null\u306f\u5e38\u306btrue\u3067\u3042\u308a\u3001null\u4ee5\u5916\u306ex\u306ex == null\u306f\u5e38\u306bfalse\u3067\u3042\u308a\u3001x.equals()\u3092\u547c\u3073\u51fa\u3057\u307e\u305b\u3093\u3002<\/p>\n<p>screen \u906e\u308b\u3001\u5b88\u308b\u3001\u7be9\u3044\u5206\u3051\u308b\u3001\u6392\u9664\u3059\u308b<\/p>\n<hr width=\"90%\">\n<p class=\"outline03\">\u6bd4\u8f03\u6f14\u7b97\u5b50<\/p>\n<table>\n<thead>\n<tr>\n<th>\u5f0f<\/th>\n<th>\u5bfe\u5fdc\u3059\u308b\u95a2\u6570<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>a > b<\/code><\/td>\n<td><code>a.compareTo(b) > 0<\/code><\/td>\n<\/tr>\n<tr>\n<td><code>a < b<\/code><\/td>\n<td><code>a.compareTo(b) < 0<\/code><\/td>\n<\/tr>\n<tr>\n<td><code>a >= b<\/code><\/td>\n<td><code>a.compareTo(b) >= 0<\/code><\/td>\n<\/tr>\n<tr>\n<td><code>a <= b<\/code><\/td>\n<td><code>a.compareTo(b) <= 0<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u3059\u3079\u3066\u306e\u6bd4\u8f03\u306f\u3001Int\u3092\u8fd4\u3059\u5fc5\u8981\u304c\u3042\u308b<a href=\"https:\/\/kotlinlang.org\/api\/latest\/jvm\/stdlib\/kotlin\/-int\/compare-to.html\" rel=\"noopener\" target=\"_blank\">CompareTo()<\/a>\u306e\u547c\u3073\u51fa\u3057\u306b\u5909\u63db\u3055\u308c\u307e\u3059\u3002<\/p>\n<hr width=\"90%\">\n<p class=\"outline03\">\u30d7\u30ed\u30d1\u30c6\u30a3\u79fb\u8b72\u6f14\u7b97\u5b50<\/p>\n<p>ProvideDelegate\u3001getValue\u304a\u3088\u3073setValue\u6f14\u7b97\u5b50\u95a2\u6570\u306f\u3001\u59d4\u4efb\u3055\u308c\u305f\u30d7\u30ed\u30d1\u30c6\u30a3\u3067\u8aac\u660e\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<hr>\n<p class=\"outline02\">\u540d\u524d\u4ed8\u304d\u95a2\u6570\u306eInfix\u547c\u3073\u51fa\u3057<\/p>\n<p>\u4e2d\u7f6e\u95a2\u6570\u547c\u3073\u51fa\u3057\u3092\u4f7f\u7528\u3057\u3066\u3001\u30ab\u30b9\u30bf\u30e0\u306e\u4e2d\u7f6e\u6f14\u7b97\u3092\u88c5\u3046\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p><span class=\"f_s\">\u203b\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u81ea\u4f5c\u306e\u95a2\u6570\u3092\u4e8c\u9805\u6f14\u7b97\u5b50\u3068\u3057\u3066\u66f8\u3051\u308b\u3088\u3046\u306b\u3067\u304d\u308b\u3089\u3057\u3044\u3002<\/p>\n<pre class=\"brush: kotlin; title: ; notranslate\" title=\"\">\r\ninfix fun Int.shl(x: Int): Int { ... }\r\n\u200b\r\n\/\/ infix\u8a18\u6cd5\u3092\u4f7f\u7528\u3057\u305f\u95a2\u6570\u547c\u3073\u51fa\u3057\u306f\u3001\r\n1 shl 2\r\n\u200b\r\n\/\/ \u4ee5\u4e0b\u3068\u540c\u3058\u3067\u3059\u3002\r\n1.shl(2)\r\n<\/pre>\n<p><\/span><\/p>\n<p>infix \u63a5\u4e2d\u8f9e\u3001\u4e2d\u7f6e\u304d\u578b<br \/>\ninfix operator \u4e8c\u9805\u6f14\u7b97\u5b50<br \/>\ninfix notation (omitting the dot and the parentheses for the call)<br \/>\n\u4e2d\u7f6e\u8a18\u6cd5(\u547c\u3073\u51fa\u3057\u306e\u30c9\u30c3\u30c8\u3068\u62ec\u5f27\u3092\u7701\u7565)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6f14\u7b97\u5b50\u306e\u30aa\u30fc\u30d0\u30fc\u30ed\u30fc\u30c9 Kotlin\u3067\u306f\u4f5c\u6210\u3059\u308b\u578b\u306b\u5bfe\u3057\u3066\u3001\u4e8b\u524d\u5b9a\u7fa9\u6e08\u3067\u3042\u308b\u6f14\u7b97\u5b50\u30bb\u30c3\u30c8\u306e\u30aa\u30fc\u30d0\u30fc\u30ed\u30fc\u30c9\u5b9f\u88c5\u3092\u63d0\u4f9b\u3067\u304d\u307e\u3059\u3002\u3053\u308c\u3089\u306e\u6f14\u7b97\u5b50\u306f\u56fa\u5b9a\u306e\u8a18\u53f7\u8868\u73fe(+\u3084*\u306a\u3069)\u3068\u56fa\u5b9a\u306e\u512a\u5148\u9806\u4f4d\u3092\u6301\u3063\u3066\u3044\u307e\u3059\u3002 \u6f14\u7b97\u5b50\u3092\u30aa\u30fc\u30d0\u30fc\u30ed...  <a class=\"excerpt-read-more\" href=\"https:\/\/mole-kingdom.com\/wpbl\/2020\/12\/24\/22864.html\" title=\"Read \u6f14\u7b97\u5b50\u306e\u30aa\u30fc\u30d0\u30fc\u30ed\u30fc\u30c9: kotlin\">\u3082\u3063\u3068\u8aad\u3080 &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[124],"tags":[],"class_list":["post-22864","post","type-post","status-publish","format-standard","hentry","category-kotlin"],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p2pLuj-5WM","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":22838,"url":"https:\/\/mole-kingdom.com\/wpbl\/2020\/12\/15\/22838.html","url_meta":{"origin":22864,"position":0},"title":"\u578b\u5224\u5b9a\u3068\u30ad\u30e3\u30b9\u30c8 : kotlin","author":"moleking","date":"2020\u5e7412\u670815\u65e5","format":false,"excerpt":"\u578b\u5224\u5b9a\u3068\u30ad\u30e3\u30b9\u30c8 is\u6f14\u7b97\u5b50\u3068!\u6f14\u7b97\u5b50\u306b\u3088\u308b\u578b\u5224\u5b9a \u203b\u3053\u308cis\u6f14\u7b97\u5b50\u3068\u5426\u5b9a\u306e!\u6f14\u7b97\u5b50\u306e\u7d44\u307f\u5408\u308f\u305b\u3060\u304b\u2026","rel":"","context":"kotlin","block_context":{"text":"kotlin","link":"https:\/\/mole-kingdom.com\/wpbl\/category\/programming\/kotlin"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":20001,"url":"https:\/\/mole-kingdom.com\/wpbl\/2018\/10\/27\/20001.html","url_meta":{"origin":22864,"position":1},"title":"\u3046\u306b\u306e\u30c8\u30b2\u306f\u523a\u3055\u308b\u3068\u75db\u3044(\u00b4\uff65\u03c9\uff65\uff40)-33","author":"moleking","date":"2018\u5e7410\u670827\u65e5","format":false,"excerpt":"\u7d50\u5c40\u3001\u529b\u5c3d\u304d\u305f\u2026\uff3f|\uffe3|\u25cb TowerDefenceTutorial\u306eTower\u30d5\u30a9\u30eb\u30c0\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u2026","rel":"","context":"C#","block_context":{"text":"C#","link":"https:\/\/mole-kingdom.com\/wpbl\/category\/programming\/csharp"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":22847,"url":"https:\/\/mole-kingdom.com\/wpbl\/2020\/12\/21\/22847.html","url_meta":{"origin":22864,"position":2},"title":"\u30a8\u30af\u30b9\u30c6\u30f3\u30b7\u30e7\u30f3(\u62e1\u5f35) : kotlin","author":"moleking","date":"2020\u5e7412\u670821\u65e5","format":false,"excerpt":"\u203b\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u306f\u5168\u3066\"Target platform: JVMRunning on kotlin v\u2026","rel":"","context":"kotlin","block_context":{"text":"kotlin","link":"https:\/\/mole-kingdom.com\/wpbl\/category\/programming\/kotlin"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":24858,"url":"https:\/\/mole-kingdom.com\/wpbl\/2021\/06\/23\/24858.html","url_meta":{"origin":22864,"position":3},"title":"\u300eWelcome to Android Basics in Kotlin\u300f\u3092\u3084\u3063\u305f(\u7d42)","author":"moleking","date":"2021\u5e746\u670823\u65e5","format":false,"excerpt":"\u30d5\u30e9\u30b0\u30e1\u30f3\u30c8\u9593\u306e\u5171\u6709 ViewModel 4. \u5171\u6709 ViewModel \u3092\u4f5c\u6210\u3059\u308b OrderVi\u2026","rel":"","context":"Android","block_context":{"text":"Android","link":"https:\/\/mole-kingdom.com\/wpbl\/category\/os\/android"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":24757,"url":"https:\/\/mole-kingdom.com\/wpbl\/2021\/06\/14\/24757.html","url_meta":{"origin":22864,"position":4},"title":"\u300eWelcome to Android Basics in Kotlin\u300f\u3092\u3084\u3063\u305f(1)","author":"moleking","date":"2021\u5e746\u670814\u65e5","format":false,"excerpt":"kotlin\u306e\u5b66\u7fd2\u3064\u3044\u3067\u306bAndroid\u306b\u3064\u3044\u3066\u306e\u5fa9\u7fd2\u3092\u3057\u3088\u3046\u3068Welcome to Android\u2026","rel":"","context":"Android","block_context":{"text":"Android","link":"https:\/\/mole-kingdom.com\/wpbl\/category\/os\/android"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/mole-kingdom.com\/wpbl\/wp-content\/uploads\/2021\/06\/notcontainerror.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/mole-kingdom.com\/wpbl\/wp-content\/uploads\/2021\/06\/notcontainerror.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/mole-kingdom.com\/wpbl\/wp-content\/uploads\/2021\/06\/notcontainerror.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":22840,"url":"https:\/\/mole-kingdom.com\/wpbl\/2020\/12\/17\/22840.html","url_meta":{"origin":22864,"position":5},"title":"\u30b7\u30fc\u30eb\u30af\u30e9\u30b9(\u5bc6\u9589\u30af\u30e9\u30b9) : kotlin","author":"moleking","date":"2020\u5e7412\u670817\u65e5","format":false,"excerpt":"\u30b7\u30fc\u30eb\u30af\u30e9\u30b9(\u5bc6\u9589\u30af\u30e9\u30b9) \u30b7\u30fc\u30eb\u30af\u30e9\u30b9\u306f\u9650\u5b9a\u7684\u306a\u30af\u30e9\u30b9\u968e\u5c64\u3092\u8868\u3059\u305f\u3081\u306b\u4f7f\u7528\u3055\u308c\u307e\u3059\u3002 \u3053\u306e\u30af\u30e9\u30b9\u3067\u2026","rel":"","context":"kotlin","block_context":{"text":"kotlin","link":"https:\/\/mole-kingdom.com\/wpbl\/category\/programming\/kotlin"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/mole-kingdom.com\/wpbl\/wp-json\/wp\/v2\/posts\/22864","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mole-kingdom.com\/wpbl\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mole-kingdom.com\/wpbl\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mole-kingdom.com\/wpbl\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mole-kingdom.com\/wpbl\/wp-json\/wp\/v2\/comments?post=22864"}],"version-history":[{"count":22,"href":"https:\/\/mole-kingdom.com\/wpbl\/wp-json\/wp\/v2\/posts\/22864\/revisions"}],"predecessor-version":[{"id":22883,"href":"https:\/\/mole-kingdom.com\/wpbl\/wp-json\/wp\/v2\/posts\/22864\/revisions\/22883"}],"wp:attachment":[{"href":"https:\/\/mole-kingdom.com\/wpbl\/wp-json\/wp\/v2\/media?parent=22864"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mole-kingdom.com\/wpbl\/wp-json\/wp\/v2\/categories?post=22864"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mole-kingdom.com\/wpbl\/wp-json\/wp\/v2\/tags?post=22864"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}