{"id":338585,"date":"2022-09-21T15:00:37","date_gmt":"2022-09-21T15:00:37","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=338585"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=338585","title":{"rendered":"<span>\u041f\u043e\u0447\u0435\u043c\u0443 \u0432\u0430\u043c \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442\u044c \u043d\u0430 Kotlin<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/fae\/00f\/f50\/fae00ff504f85f548162c28e3196493a.png\" width=\"780\" height=\"439\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/fae\/00f\/f50\/fae00ff504f85f548162c28e3196493a.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u042f \u0445\u043e\u0447\u0443 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0432\u0430\u043c \u043e \u044f\u0437\u044b\u043a\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f Kotlin \u0438 \u043e \u0442\u043e\u043c, \u043f\u043e\u0447\u0435\u043c\u0443 \u0432\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0435\u0433\u043e \u0434\u043b\u044f \u0441\u0432\u043e\u0435\u0433\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430. \u0420\u0430\u043d\u044c\u0448\u0435 \u044f \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0438\u0442\u0430\u043b Java, \u043d\u043e \u0437\u0430 \u043f\u0440\u043e\u0448\u0435\u0434\u0448\u0438\u0439 \u0433\u043e\u0434 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b, \u0447\u0442\u043e \u043a\u043e\u0434\u0438\u0440\u0443\u044e \u043d\u0430 Kotlin \u043f\u0440\u0438 \u043b\u044e\u0431\u043e\u0439 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438, \u0438 \u0441\u0435\u0439\u0447\u0430\u0441 \u044f \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0435 \u043c\u043e\u0433\u0443 \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u0442\u044c \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044e, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 Java \u0431\u044b\u043b \u0431\u044b \u043b\u0443\u0447\u0448\u0438\u043c \u0432\u044b\u0431\u043e\u0440\u043e\u043c.<\/p>\n<p>\u041e\u043d \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043d \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0435\u0439 <a href=\"https:\/\/www.jetbrains.com\/\"><strong><u>JetBrains<\/u><\/strong><\/a>, \u0438 \u0442\u043e\u0442 \u0444\u0430\u043a\u0442, \u0447\u0442\u043e \u0438\u043c\u0435\u043d\u043d\u043e \u044d\u0442\u0438 \u043b\u044e\u0434\u0438 \u0441\u0442\u043e\u044f\u0442 \u0432 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0442\u0430\u043a\u043e\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430 <a href=\"https:\/\/www.jetbrains.com\/products.html?fromMenu#type=ide\"><u>IDE<\/u>,<\/a> \u043a\u0430\u043a <strong>IntelliJ<\/strong> \u0438 <strong>ReSharper<\/strong>, \u0432 \u043f\u043e\u043b\u043d\u043e\u0439 \u043c\u0435\u0440\u0435 \u043e\u0442\u0440\u0430\u0436\u0430\u0435\u0442\u0441\u044f \u0438 \u0432 Kotlin. \u041e\u043d <strong>\u043f\u0440\u0430\u0433\u043c\u0430\u0442\u0438\u0447\u0435\u043d<\/strong> \u0438 <strong>\u043b\u0430\u043a\u043e\u043d\u0438\u0447\u0435\u043d<\/strong>, \u0434\u0435\u043b\u0430\u0435\u0442 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u0438\u044f\u0442\u043d\u044b\u043c \u0438 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u043c \u0437\u0430\u043d\u044f\u0442\u0438\u0435\u043c.<\/p>\n<p>\u0425\u043e\u0442\u044f Kotlin \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u0432 <a href=\"https:\/\/kotlinlang.org\/docs\/tutorials\/javascript\/kotlin-to-javascript\/kotlin-to-javascript.html\"><strong><u>JavaScript<\/u><\/strong><\/a>, \u0430 \u0441\u043a\u043e\u0440\u043e \u0438 \u0432 <a href=\"https:\/\/blog.jetbrains.com\/kotlin\/2017\/04\/kotlinnative-tech-preview-kotlin-without-a-vm\/\"><strong><u>\u043c\u0430\u0448\u0438\u043d\u043d\u044b\u0439 \u043a\u043e\u0434<\/u><\/strong><\/a>, \u044f \u0441\u043e\u0441\u0440\u0435\u0434\u043e\u0442\u043e\u0447\u0443\u0441\u044c \u043d\u0430 \u0435\u0433\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0441\u0440\u0435\u0434\u0435 &#8212; <strong>JVM<\/strong>.<\/p>\n<p>\u0418\u0442\u0430\u043a, \u0432\u043e\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438\u0447\u0438\u043d, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0432\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043d\u0430 Kotlin (\u043d\u0443\u043c\u0435\u0440\u0430\u0446\u0438\u044f \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u0430, \u0431\u0435\u0437 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0430):<\/p>\n<p><strong>0# <\/strong><a href=\"https:\/\/kotlinlang.org\/docs\/reference\/java-interop.html\"><strong><u>\u0412\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441 Java<\/u><\/strong><\/a><\/p>\n<p>Kotlin \u043d\u0430 <strong>100% \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c \u0441 Java<\/strong>. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0432 \u0431\u0443\u043a\u0432\u0430\u043b\u044c\u043d\u043e\u043c \u0441\u043c\u044b\u0441\u043b\u0435 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0430\u0434 \u0441\u0432\u043e\u0438\u043c\u0438 \u0441\u0442\u0430\u0440\u044b\u043c\u0438 Java-\u043f\u0440\u043e\u0435\u043a\u0442\u0430\u043c\u0438, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f Kotlin. \u0412\u0441\u0435 \u0432\u0430\u0448\u0438 \u043b\u044e\u0431\u0438\u043c\u044b\u0435 <strong>Java-\u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0438<\/strong> <strong>\u043f\u043e-\u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b<\/strong>, \u0438 \u043b\u044e\u0431\u043e\u0439 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b \u043d\u0430\u043f\u0438\u0448\u0435\u0442\u0435 \u043d\u0430 Kotlin, \u0431\u0443\u0434\u0435\u0442 \u043b\u0435\u0433\u043a\u043e \u043f\u0440\u0438\u043d\u044f\u0442 \u0432\u0430\u0448\u0438\u043c \u0443\u043f\u0435\u0440\u0442\u044b\u043c \u0434\u0440\u0443\u0433\u043e\u043c, \u043b\u044e\u0431\u044f\u0449\u0438\u043c Java.<\/p>\n<p><strong>1# <\/strong><a href=\"https:\/\/kotlinlang.org\/docs\/reference\/basic-syntax.html\"><strong><u>\u0417\u043d\u0430\u043a\u043e\u043c\u044b\u0439 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441<\/u><\/strong><\/a><\/p>\n<p>Kotlin &#8212; \u044d\u0442\u043e \u043d\u0435 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043d\u0435\u043e\u0431\u044b\u0447\u043d\u044b\u0439 \u044f\u0437\u044b\u043a, \u0440\u043e\u0436\u0434\u0435\u043d\u043d\u044b\u0439 \u0432 \u0430\u043a\u0430\u0434\u0435\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043a\u0440\u0443\u0433\u0430\u0445. \u0415\u0433\u043e \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u0437\u043d\u0430\u043a\u043e\u043c \u043b\u044e\u0431\u043e\u043c\u0443 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0443, \u043f\u0440\u0438\u0448\u0435\u0434\u0448\u0435\u043c\u0443 \u0438\u0437 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Object-oriented_programming\"><u>\u041e\u041e\u041f<\/u><\/a>, \u0438 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u0438\u043b\u0438 \u043c\u0435\u043d\u0435\u0435 \u043f\u043e\u043d\u044f\u0442\u0435\u043d \u0441 \u0441\u0430\u043c\u043e\u0433\u043e \u043d\u0430\u0447\u0430\u043b\u0430. \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u0435\u0441\u0442\u044c <em>\u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 <\/em>\u043e\u0442\u043b\u0438\u0447\u0438\u044f \u043e\u0442 Java, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0435\u0440\u0435\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u044b\u0435 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u044b \u0438\u043b\u0438 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 <code>val<\/code> <code>var<\/code>. \u0412 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u043c \u043d\u0438\u0436\u0435 \u0441\u043d\u0438\u043f\u043f\u0435\u0442\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0430 \u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430:<\/p>\n<pre><code class=\"kotlin\">class Foo {      val b: String = \"b\"     \/\/ val means unmodifiable     var i: Int = 0          \/\/ var means modifiable      fun hello() {         val str = \"Hello\"         print(\"$str World\")     }      fun sum(x: Int, y: Int): Int {         return x + y     }      fun maxOf(a: Float, b: Float) = if (a > b) a else b  }<\/code><\/pre>\n<p><strong>2#<\/strong> <a href=\"https:\/\/kotlinlang.org\/docs\/reference\/basic-types.html#string-templates\"><strong><u>\u0418\u043d\u0442\u0435\u0440\u043f\u043e\u043b\u044f\u0446\u0438\u044f \u0441\u0442\u0440\u043e\u043a<\/u><\/strong><\/a><\/p>\n<p>\u042d\u0442\u043e \u043a\u0430\u043a \u0435\u0441\u043b\u0438 \u0431\u044b \u0432 \u044f\u0437\u044b\u043a \u0431\u044b\u043b\u0430 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u0430 \u0431\u043e\u043b\u0435\u0435 \u0443\u043c\u043d\u0430\u044f \u0438 \u0447\u0438\u0442\u0430\u0431\u0435\u043b\u044c\u043d\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>String.format()<\/code> \u0438\u0437 Java:<\/p>\n<pre><code class=\"kotlin\">val x = 4 val y = 7 print(\"sum of $x and $y is ${x + y}\")  \/\/ sum of 4 and 7 is 11<\/code><\/pre>\n<p><strong>3#<\/strong> <a href=\"https:\/\/kotlinlang.org\/docs\/reference\/properties.html\"><strong><u>\u0412\u044b\u0432\u043e\u0434 \u0442\u0438\u043f\u043e\u0432<\/u><\/strong><\/a><\/p>\n<p>Kotlin \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u0432\u0430\u0448\u0438 \u0442\u0438\u043f\u044b, \u0435\u0441\u043b\u0438 \u0432\u044b \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0435, \u0447\u0442\u043e \u044d\u0442\u043e \u0443\u043b\u0443\u0447\u0448\u0438\u0442 \u0447\u0438\u0442\u0430\u0431\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c:<\/p>\n<pre><code class=\"kotlin\">val a = \"abc\"                         \/\/ type inferred to String val b = 4                             \/\/ type inferred to Int  val c: Double = 0.7                   \/\/ type declared explicitly val d: List&lt;String> = ArrayList()     \/\/ type declared explicitly<\/code><\/pre>\n<p><strong>4#<\/strong> <a href=\"https:\/\/kotlinlang.org\/docs\/reference\/typecasts.html\"><strong><u>&#171;\u0423\u043c\u043d\u044b\u0435&#187; \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f. (Smart Casts)<\/u><\/strong><\/a><\/p>\n<p>\u041a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 Kotlin \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0435\u0442 \u0432\u0430\u0448\u0443 \u043b\u043e\u0433\u0438\u043a\u0443 \u0438 <strong>\u043f\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u043e\u0432<\/strong>, \u0447\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u0438\u0437\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043e\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a <code>instanceof<\/code> \u0438 \u044f\u0432\u043d\u044b\u0445 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0439:<\/p>\n<pre><code class=\"kotlin\">if (obj is String) {     print(obj.toUpperCase())     \/\/ obj is now known to be a String }<\/code><\/pre>\n<p><strong>5#<\/strong> <a href=\"https:\/\/kotlinlang.org\/docs\/reference\/equality.html\"><strong><u>\u0418\u043d\u0442\u0443\u0438\u0442\u0438\u0432\u043d\u044b\u0435 \u0440\u0430\u0432\u0435\u043d\u0441\u0442\u0432\u0430<\/u><\/strong><\/a><\/p>\n<p>\u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u0442\u044c \u044f\u0432\u043d\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c <code>equals()<\/code>, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 <code>==<\/code> \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043d\u043e\u0435 \u0440\u0430\u0432\u0435\u043d\u0441\u0442\u0432\u043e:<\/p>\n<pre><code class=\"kotlin\">val john1 = Person(\"John\") val john2 = Person(\"John\") john1 == john2    \/\/ true  (structural equality) john1 === john2   \/\/ false (referential equality)<\/code><\/pre>\n<p><strong>6#<\/strong> <a href=\"https:\/\/kotlinlang.org\/docs\/reference\/functions.html#default-arguments\"><strong><u>\u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e<\/u><\/strong><\/a><\/p>\n<p>\u041d\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0441 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430\u043c\u0438:<\/p>\n<pre><code class=\"kotlin\">fun build(title: String, width: Int = 800, height: Int = 600) {     Frame(title, width, height) }<\/code><\/pre>\n<p><strong>7#<\/strong> <a href=\"https:\/\/kotlinlang.org\/docs\/reference\/functions.html#named-arguments\"><strong><u>\u0418\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b<\/u><\/strong><\/a><\/p>\n<p>\u0412 \u0441\u043e\u0447\u0435\u0442\u0430\u043d\u0438\u0438 \u0441 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u0438\u0437\u0431\u0430\u0432\u043b\u044f\u044e\u0442 \u043e\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/en.wikipedia.org\/wiki\/Builder_pattern\"><u>\u0441\u0442\u0440\u043e\u0438\u0442\u0435\u043b\u0435\u0439 (builders)<\/u><\/a>:<\/p>\n<pre><code class=\"kotlin\">build(\"PacMan\", 400, 300)                           \/\/ equivalent build(title = \"PacMan\", width = 400, height = 300)  \/\/ equivalent build(width = 400, height = 300, title = \"PacMan\")  \/\/ equivalent<\/code><\/pre>\n<p><strong>8#<\/strong> <a href=\"https:\/\/kotlinlang.org\/docs\/reference\/control-flow.html#when-expression\"><strong><u>\u0412\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 When<\/u><\/strong><\/a><\/p>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0437\u0430\u043c\u0435\u043d\u044b \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0443 switch \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0431\u043e\u043b\u0435\u0435 \u0443\u0434\u043e\u0431\u043d\u043e\u0435 \u0438 \u0433\u0438\u0431\u043a\u043e\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 <em>when<\/em>:<\/p>\n<pre><code class=\"kotlin\">when (x) {     1 -> print(\"x is 1\")     2 -> print(\"x is 2\")     3, 4 -> print(\"x is 3 or 4\")     in 5..10 -> print(\"x is 5, 6, 7, 8, 9, or 10\")     else -> print(\"x is out of range\") }<\/code><\/pre>\n<p>\u041e\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043a\u0430\u043a \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435, \u0438 \u043a\u0430\u043a \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440, \u0441 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u043c, \u0438 \u0431\u0435\u0437 \u043d\u0435\u0433\u043e:<\/p>\n<pre><code class=\"kotlin\">val res: Boolean = when {     obj == null -> false     obj is String -> true     else -> throw IllegalStateException() }<\/code><\/pre>\n<p><strong>9#<\/strong> <a href=\"https:\/\/kotlinlang.org\/docs\/reference\/properties.html#getters-and-setters\"><strong><u>\u0421\u0432\u043e\u0439\u0441\u0442\u0432\u0430<\/u><\/strong><\/a><\/p>\n<p>\u041a \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u043c \u043f\u043e\u043b\u044f\u043c \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043e \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 set \u0438 get, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u043d\u0430\u043c \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0437\u0430\u0433\u0440\u043e\u043c\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u043a\u043e\u0434\u0430 \u0431\u0435\u0441\u0441\u043c\u044b\u0441\u043b\u0435\u043d\u043d\u044b\u043c\u0438 <a href=\"http:\/\/stackoverflow.com\/questions\/1568091\/why-use-getters-and-setters\"><u>\u0433\u0435\u0442\u0442\u0435\u0440\u0430\u043c\u0438 \u0438 \u0441\u0435\u0442\u0442\u0435\u0440\u0430\u043c\u0438<\/u><\/a>.<\/p>\n<pre><code class=\"kotlin\">class Frame {     var width: Int = 800     var height: Int = 600      val pixels: Int         get() = width * height }<\/code><\/pre>\n<p><strong>10#<\/strong> <a href=\"https:\/\/kotlinlang.org\/docs\/reference\/data-classes.html\"><strong><u>\u041a\u043b\u0430\u0441\u0441 \u0434\u0430\u043d\u043d\u044b\u0445 (Data Class)<\/u><\/strong><\/a><\/p>\n<p>\u042d\u0442\u043e POJO (Plain Old Java Object) \u0441 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438 <code>toString()<\/code>, <code>equals()<\/code>, <code>hashCode()<\/code> \u0438 <code>copy()<\/code>, \u0438 \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 Java \u043e\u043d \u043d\u0435 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u043f\u043e\u0447\u0442\u0438 100 \u0441\u0442\u0440\u043e\u043a \u043a\u043e\u0434\u0430:<\/p>\n<pre><code class=\"kotlin\">data class Person(val name: String,                   var email: String,                   var age: Int)  val john = Person(\"John\", \"john@gmail.com\", 112)<\/code><\/pre>\n<p><strong>11#<\/strong> <a href=\"https:\/\/kotlinlang.org\/docs\/reference\/operator-overloading.html\"><strong><u>\u041f\u0435\u0440\u0435\u0433\u0440\u0443\u0437\u043a\u0430 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430<\/u><\/strong><\/a><\/p>\n<p>\u041f\u0440\u0435\u0434\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0436\u0435\u043d \u0434\u043b\u044f \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044f \u0447\u0438\u0442\u0430\u0431\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438:<\/p>\n<pre><code class=\"kotlin\">data class Vec(val x: Float, val y: Float) {     operator fun plus(v: Vec) = Vec(x + v.x, y + v.y) }  val v = Vec(2f, 3f) + Vec(4f, 1f)<\/code><\/pre>\n<p><strong>12#<\/strong> <a href=\"https:\/\/kotlinlang.org\/docs\/reference\/multi-declarations.html\"><strong><u>\u041e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u0435\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0438\u0437\u0430\u0446\u0438\u0438<\/u><\/strong><\/a><\/p>\n<p>\u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0434\u0435\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u044b, \u0447\u0442\u043e, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u0434\u043b\u044f \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u043a\u0430\u0440\u0442:<\/p>\n<pre><code class=\"kotlin\">for ((key, value) in map) {     print(\"Key: $key\")     print(\"Value: $value\") }<\/code><\/pre>\n<p><strong>13#<\/strong> <a href=\"https:\/\/kotlinlang.org\/docs\/reference\/ranges.html\"><strong><u>\u0414\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u044b<\/u><\/strong><\/a><\/p>\n<p>\u0414\u043b\u044f \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044f \u0447\u0438\u0442\u0430\u0431\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438:<\/p>\n<pre><code class=\"kotlin\">for (i in 1..100) { ... }  for (i in 0 until 100) { ... } for (i in 2..10 step 2) { ... }  for (i in 10 downTo 1) { ... }  if (x in 1..10) { ... }<\/code><\/pre>\n<p><strong>14#<\/strong> <a href=\"https:\/\/kotlinlang.org\/docs\/reference\/extensions.html\"><strong><u>\u0424\u0443\u043d\u043a\u0446\u0438\u0438 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f<\/u><\/strong><\/a><\/p>\n<p>\u041f\u043e\u043c\u043d\u0438\u0442\u0435, \u043a\u043e\u0433\u0434\u0430 \u0432\u0430\u043c \u0432\u043f\u0435\u0440\u0432\u044b\u0435 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u043b\u043e\u0441\u044c \u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c <code>List<\/code> \u0432 Java? \u0412\u044b \u043d\u0435 \u043c\u043e\u0433\u043b\u0438 \u043d\u0430\u0439\u0442\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044e <code>sort()<\/code> \u0438 \u0432\u0430\u043c \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0443\u0437\u043d\u0430\u0442\u044c \u043e <code>Collections.sort()<\/code>. \u0410 \u043f\u043e\u0437\u0436\u0435, \u043a\u043e\u0433\u0434\u0430 \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c <code>String<\/code> \u0441 \u0437\u0430\u0433\u043b\u0430\u0432\u043d\u043e\u0439 \u0431\u0443\u043a\u0432\u044b, \u0442\u043e \u044d\u0442\u043e \u043f\u0440\u0438\u0432\u0435\u043b\u043e \u043a \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044e \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0432\u044b \u043d\u0435 \u0437\u043d\u0430\u043b\u0438 \u043e <code>StringUtils.capitalize()<\/code>.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0431\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u043b \u0441\u043f\u043e\u0441\u043e\u0431 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u043e\u0432\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432 \u0441\u0442\u0430\u0440\u044b\u0435 \u043a\u043b\u0430\u0441\u0441\u044b; \u0442\u043e\u0433\u0434\u0430 \u0432\u0430\u0448\u0430 IDE \u0441\u043c\u043e\u0433\u043b\u0430 \u0431\u044b \u043f\u043e\u043c\u043e\u0447\u044c \u0432\u0430\u043c \u043d\u0430\u0439\u0442\u0438 \u043d\u0443\u0436\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043f\u0440\u0438 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u043c \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u043a\u043e\u0434\u0430. \u0412 Kotlin \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0438\u043c\u0435\u043d\u043d\u043e \u044d\u0442\u043e:<\/p>\n<pre><code class=\"kotlin\">fun String.replaceSpaces(): String {     return this.replace(' ', '_') }  val formatted = str.replaceSpaces()<\/code><\/pre>\n<p>\u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 Java, \u0447\u0442\u043e \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b\u043e\u0441\u044c \u0434\u043b\u044f <code>String<\/code>:<\/p>\n<pre><code class=\"kotlin\">str.removeSuffix(\".txt\") str.capitalize() str.substringAfterLast(\"\/\") str.replaceAfter(\":\", \"classified\")<\/code><\/pre>\n<p><strong>15#<\/strong> <a href=\"https:\/\/kotlinlang.org\/docs\/reference\/null-safety.html\"><strong><u>Null \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c<\/u><\/strong><\/a><\/p>\n<p>Java &#8212; \u044d\u0442\u043e \u0442\u043e, \u0447\u0442\u043e \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043d\u0430\u0437\u0432\u0430\u0442\u044c <em>\u043f\u043e\u0447\u0442\u0438<\/em> \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0442\u0438\u043f\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u044f\u0437\u044b\u043a\u043e\u043c. \u0412 \u043d\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u0442\u0438\u043f\u0430 <code>String<\/code> \u043d\u0435 <em>\u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e <\/em>\u0441\u0441\u044b\u043b\u0430\u0435\u0442\u0441\u044f \u043d\u0430 <code>String<\/code> &#8212; \u043e\u043d\u0430 \u043c\u043e\u0436\u0435\u0442 \u0441\u0441\u044b\u043b\u0430\u0442\u044c\u0441\u044f \u043d\u0430 <code>null<\/code>. \u041d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u043c\u044b \u043f\u0440\u0438\u0432\u044b\u043a\u043b\u0438 \u043a \u044d\u0442\u043e\u043c\u0443, \u044d\u0442\u043e \u0441\u0432\u043e\u0434\u0438\u0442 \u043d\u0430 \u043d\u0435\u0442 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0442\u0438\u043f\u043e\u0432, \u0438 \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c Java \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0436\u0438\u0442\u044c \u0432 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e\u043c \u0441\u0442\u0440\u0430\u0445\u0435 \u043f\u0435\u0440\u0435\u0434 \u043e\u0448\u0438\u0431\u043a\u043e\u0439 <a href=\"http:\/\/stackoverflow.com\/questions\/218384\/what-is-a-nullpointerexception-and-how-do-i-fix-it\"><u>NPE<\/u><\/a> (<code>NullPointerException<\/code>).<\/p>\n<p>Kotlin \u0440\u0435\u0448\u0430\u0435\u0442 \u044d\u0442\u0443 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443, \u043f\u0440\u043e\u0432\u043e\u0434\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 <strong>\u043d\u0435\u043d\u0443\u043b\u0435\u0432\u044b\u043c\u0438 (non-null<\/strong>) \u0438\u00a0 <strong>\u043e\u0431\u043d\u0443\u043b\u044f\u0435\u043c\u044b\u043c\u0438 (nullable) \u0442\u0438\u043f\u0430\u043c\u0438<\/strong>. \u0422\u0438\u043f\u044b \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f non-null, \u0438 \u0438\u0445 \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c nullable, \u0434\u043e\u0431\u0430\u0432\u0438\u0432 <code>?<\/code> \u043a\u0430\u043a, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code class=\"kotlin\">var a: String = \"abc\" a = null                \/\/ compile error  var b: String? = \"xyz\" b = null                \/\/ no problem<\/code><\/pre>\n<p>Kotlin \u0437\u0430\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0432\u0430\u0441 \u0437\u0430\u0449\u0438\u0449\u0430\u0442\u044c\u0441\u044f \u043e\u0442 NPE \u0432\u0441\u044f\u043a\u0438\u0439 \u0440\u0430\u0437, \u043a\u043e\u0433\u0434\u0430 \u0432\u044b \u043e\u0431\u0440\u0430\u0449\u0430\u0435\u0442\u0435\u0441\u044c \u043a nullable-\u0442\u0438\u043f\u0443:<\/p>\n<pre><code>val x = b.length        \/\/ compile error: b might be null<\/code><\/pre>\n<p>\u0418 \u0445\u043e\u0442\u044f \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u0433\u0440\u043e\u043c\u043e\u0437\u0434\u043a\u0438\u043c, \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0432\u0441\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044f\u043c Kotlin. \u0423 \u043d\u0430\u0441 \u0432\u0441\u0435 \u0435\u0449\u0435 \u0435\u0441\u0442\u044c \u0443\u043c\u043d\u043e\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u0442 nullable \u0442\u0438\u043f\u044b \u0432 non-null \u0432\u0435\u0437\u0434\u0435, \u0433\u0434\u0435 \u044d\u0442\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e:<\/p>\n<pre><code>if (b == null) return val x = b.length        \/\/ no problem<\/code><\/pre>\n<p>\u041c\u044b \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 <code>?.<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u043d\u0430 \u043d\u0443\u043b\u0435\u0432\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432\u043c\u0435\u0441\u0442\u043e \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0432\u044b\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0442\u044c NPE:<\/p>\n<pre><code>val x = b?.length       \/\/ type of x is nullable Int<\/code><\/pre>\n<p>\u0411\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u0435 \u0432\u044b\u0437\u043e\u0432\u044b \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u0442\u044c \u0432 \u0446\u0435\u043f\u043e\u0447\u043a\u0438, \u0447\u0442\u043e\u0431\u044b \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a if-not-null (\u0435\u0441\u043b\u0438-\u043d\u0435-\u043d\u043e\u043b\u044c), \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u0438\u043d\u043e\u0433\u0434\u0430 \u043f\u0438\u0448\u0435\u043c \u0432 \u0434\u0440\u0443\u0433\u0438\u0445 \u044f\u0437\u044b\u043a\u0430\u0445, \u0438 \u0435\u0441\u043b\u0438 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, \u043e\u0442\u043b\u0438\u0447\u043d\u043e\u0435 \u043e\u0442 <code>null<\/code>, \u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c elvis-\u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 <code>?:<\/code>:<\/p>\n<pre><code>val name = ship?.captain?.name ?: \"unknown\"<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u043d\u0438\u0447\u0435\u0433\u043e \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u0432\u0430\u043c \u043d\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442, \u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0432 NPE \u043a\u0440\u0430\u0439\u043d\u0435 \u0432\u0435\u043b\u0438\u043a\u0430, \u0442\u043e \u0441\u043a\u0430\u0436\u0438\u0442\u0435 \u043e\u0431 \u044d\u0442\u043e\u043c \u044f\u0432\u043d\u043e:<\/p>\n<pre><code>val x = b?.length ?: throw NullPointerException()  \/\/ same as below val x = b!!.length                                 \/\/ same as above<\/code><\/pre>\n<p><strong>16# <\/strong><a href=\"https:\/\/kotlinlang.org\/docs\/reference\/lambdas.html\"><strong><u>\u0423\u043b\u0443\u0447\u0448\u0435\u043d\u043d\u044b\u0435 \u043b\u044f\u043c\u0431\u0434\u044b<\/u><\/strong><\/a><\/p>\n<p>\u042d\u0442\u043e \u0445\u043e\u0440\u043e\u0448\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043b\u044f\u043c\u0431\u0434 &#8212; \u043e\u043d\u0430 \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u043e \u0441\u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u043c\u0435\u0436\u0434\u0443 \u0447\u0438\u0442\u0430\u0431\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e \u0438 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c\u044e, \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u043f\u0440\u043e\u0434\u0443\u043c\u0430\u043d\u043d\u043e\u043c\u0443 \u0434\u0438\u0437\u0430\u0439\u043d\u0443, \u0441 \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u043e\u043c:<\/p>\n<pre><code class=\"kotlin\">val sum = { x: Int, y: Int -> x + y }   \/\/ type: (Int, Int) -> Int val res = sum(4,7)                      \/\/ res == 11<\/code><\/pre>\n<p>\u0410 \u0432\u043e\u0442 \u0438 \u0442\u043e\u043b\u043a\u043e\u0432\u044b\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f:<\/p>\n<ol>\n<li>\n<p>\u0421\u043a\u043e\u0431\u043a\u0438 \u043c\u0435\u0442\u043e\u0434\u0430 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u044b \u0438\u043b\u0438 \u043e\u043f\u0443\u0449\u0435\u043d\u044b, \u0435\u0441\u043b\u0438 \u043b\u044f\u043c\u0431\u0434\u0430 \u0438\u0434\u0435\u0442 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u043b\u0438\u0431\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u043c \u043c\u0435\u0442\u043e\u0434\u0430.<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u043c\u044b \u0440\u0435\u0448\u0438\u043b\u0438 \u043d\u0435 \u043e\u0431\u044a\u044f\u0432\u043b\u044f\u0442\u044c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u043e\u0434\u043d\u043e\u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043d\u043e\u0439 \u043b\u044f\u043c\u0431\u0434\u044b, \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u043d\u0435\u044f\u0432\u043d\u043e \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d \u043f\u043e\u0434 \u0438\u043c\u0435\u043d\u0435\u043c <code>it<\/code>.<\/p>\n<\/li>\n<\/ol>\n<p>\u042d\u0442\u0438 \u0444\u0430\u043a\u0442\u044b \u0432 \u0441\u043e\u0432\u043e\u043a\u0443\u043f\u043d\u043e\u0441\u0442\u0438 \u0434\u0435\u043b\u0430\u044e\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0442\u0440\u0438 \u0441\u0442\u0440\u043e\u043a\u0438 \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u043d\u044b\u043c\u0438:<\/p>\n<pre><code class=\"kotlin\">numbers.filter({ x -> x.isPrime() }) numbers.filter { x -> x.isPrime() } numbers.filter { it.isPrime() }<\/code><\/pre>\n<p>\u0418 \u044d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0430\u043c \u043f\u0438\u0441\u0430\u0442\u044c \u043b\u0430\u043a\u043e\u043d\u0438\u0447\u043d\u044b\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u0434 &#8212; \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u043d\u0430 \u044d\u0442\u0443 \u043a\u0440\u0430\u0441\u043e\u0442\u0443:<\/p>\n<pre><code class=\"kotlin\">persons     .filter { it.age >= 18 }     .sortedBy { it.name }     .map { it.email }     .forEach { print(it) }<\/code><\/pre>\n<p>\u0421\u0438\u0441\u0442\u0435\u043c\u0430 \u043b\u044f\u043c\u0431\u0434 Kotlin \u0432 \u0441\u043e\u0447\u0435\u0442\u0430\u043d\u0438\u0438 \u0441 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u0434\u0435\u043b\u0430\u0435\u0442 \u0435\u0433\u043e \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u044b\u043c \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f <a href=\"https:\/\/en.wikipedia.org\/wiki\/Domain-specific_language\"><u>DSL<\/u><\/a>. \u0412\u0437\u0433\u043b\u044f\u043d\u0438\u0442\u0435 \u043d\u0430 <a href=\"https:\/\/github.com\/Kotlin\/anko\"><u>Anko<\/u><\/a> \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 DSL, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0438\u0437\u0432\u0430\u043d \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0443 Android:<\/p>\n<pre><code class=\"kotlin\">verticalLayout {     padding = dip(30)     editText {         hint = \u201cName\u201d         textSize = 24f     }     editText {         hint = \u201cPassword\u201d         textSize = 24f     }     button(\u201cLogin\u201d) {         textSize = 26f     } }<\/code><\/pre>\n<p><strong>17#<\/strong> <a href=\"https:\/\/kotlinlang.org\/docs\/tutorials\/getting-started.html\"><strong><u>\u041f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 IDE<\/u><\/strong><\/a><\/p>\n<p>\u0423 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432, \u0435\u0441\u043b\u0438 \u0432\u044b \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442\u0435\u0441\u044c \u043d\u0430\u0447\u0430\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 Kotlin, \u043d\u043e \u044f \u043d\u0430\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <strong>IntelliJ<\/strong>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 <strong>\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432 \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0442\u0435 \u0441 Kotlin<\/strong> &#8212; \u0435\u0433\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u0443\u044e\u0442 \u0432\u0441\u0435 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0438 \u044f\u0437\u044b\u043a, \u0438 IDE \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043e\u0434\u043d\u0438\u043c\u0438 \u0438 \u0442\u0435\u043c\u0438 \u0436\u0435 \u043b\u044e\u0434\u044c\u043c\u0438.<\/p>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e, \u043d\u043e \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430, \u0432\u043e\u0442 \u0447\u0442\u043e \u0432\u0441\u043f\u043b\u044b\u043b\u043e, \u043a\u043e\u0433\u0434\u0430 \u044f \u0432\u043f\u0435\u0440\u0432\u044b\u0435 \u043f\u043e\u043f\u044b\u0442\u0430\u043b\u0441\u044f \u0441\u043a\u043e\u043f\u0438\u043f\u0430\u0441\u0442\u0438\u0442\u044c Java-\u043a\u043e\u0434 \u0441\u043e Stack Overflow:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/6c6\/d0e\/2ad\/6c6d0e2ad6f94dbd8209d354f5e38193.png\" width=\"875\" height=\"321\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/6c6\/d0e\/2ad\/6c6d0e2ad6f94dbd8209d354f5e38193.png\"\/><figcaption><\/figcaption><\/figure>\n<p>IntelliJ \u0437\u0430\u043c\u0435\u0442\u0438\u0442, \u0435\u0441\u043b\u0438 \u0432\u044b \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u0435 Java-\u043a\u043e\u0434 \u0432 \u0444\u0430\u0439\u043b Kotlin<\/p>\n<hr\/>\n<blockquote>\n<p>\u0417\u0430\u0432\u0442\u0440\u0430 \u0441\u043e\u0441\u0442\u043e\u0438\u0442\u0441\u044f \u043e\u0442\u043a\u0440\u044b\u0442\u043e\u0435 \u0437\u0430\u043d\u044f\u0442\u0438\u0435 <strong>\u00ab\u041e\u0441\u043d\u043e\u0432\u044b \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432\u00bb<\/strong>, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043c\u044b \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u044b \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0438 \u0438\u0445 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0432 Kotlin. \u041f\u043e\u0439\u043c\u0435\u043c, \u043a\u0430\u043a \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u043e-\u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0438\u0437\u043d\u0443\u0442\u0440\u0438, \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0441\u0432\u043e\u0438 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u044f\u0437\u044b\u043a\u0430 Kotlin. \u0421\u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u0443\u0435\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c \u0434\u0430\u043d\u043d\u044b\u0445. \u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0439\u0442\u0435\u0441\u044c <a href=\"https:\/\/otus.pw\/4tnJE\/\"><strong>\u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435.<\/strong><\/a><\/p>\n<\/blockquote>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/company\/otus\/blog\/689436\/\"> https:\/\/habr.com\/ru\/company\/otus\/blog\/689436\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u042f \u0445\u043e\u0447\u0443 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0432\u0430\u043c \u043e \u044f\u0437\u044b\u043a\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f Kotlin \u0438 \u043e \u0442\u043e\u043c, \u043f\u043e\u0447\u0435\u043c\u0443 \u0432\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0435\u0433\u043e \u0434\u043b\u044f \u0441\u0432\u043e\u0435\u0433\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430. \u0420\u0430\u043d\u044c\u0448\u0435 \u044f \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0438\u0442\u0430\u043b Java, \u043d\u043e \u0437\u0430 \u043f\u0440\u043e\u0448\u0435\u0434\u0448\u0438\u0439 \u0433\u043e\u0434 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b, \u0447\u0442\u043e \u043a\u043e\u0434\u0438\u0440\u0443\u044e \u043d\u0430 Kotlin \u043f\u0440\u0438 \u043b\u044e\u0431\u043e\u0439 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438, \u0438 \u0441\u0435\u0439\u0447\u0430\u0441 \u044f \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0435 \u043c\u043e\u0433\u0443 \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u0442\u044c \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044e, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 Java \u0431\u044b\u043b \u0431\u044b \u043b\u0443\u0447\u0448\u0438\u043c \u0432\u044b\u0431\u043e\u0440\u043e\u043c.<\/p>\n<p>\u041e\u043d \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043d \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0435\u0439 <a href=\"https:\/\/www.jetbrains.com\/\"><strong><u>JetBrains<\/u><\/strong><\/a>, \u0438 \u0442\u043e\u0442 \u0444\u0430\u043a\u0442, \u0447\u0442\u043e \u0438\u043c\u0435\u043d\u043d\u043e \u044d\u0442\u0438 \u043b\u044e\u0434\u0438 \u0441\u0442\u043e\u044f\u0442 \u0432 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0442\u0430\u043a\u043e\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430 <a href=\"https:\/\/www.jetbrains.com\/products.html?fromMenu#type=ide\"><u>IDE<\/u>,<\/a> \u043a\u0430\u043a <strong>IntelliJ<\/strong> \u0438 <strong>ReSharper<\/strong>, \u0432 \u043f\u043e\u043b\u043d\u043e\u0439 \u043c\u0435\u0440\u0435 \u043e\u0442\u0440\u0430\u0436\u0430\u0435\u0442\u0441\u044f \u0438 \u0432 Kotlin. \u041e\u043d <strong>\u043f\u0440\u0430\u0433\u043c\u0430\u0442\u0438\u0447\u0435\u043d<\/strong> \u0438 <strong>\u043b\u0430\u043a\u043e\u043d\u0438\u0447\u0435\u043d<\/strong>, \u0434\u0435\u043b\u0430\u0435\u0442 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u0438\u044f\u0442\u043d\u044b\u043c \u0438 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u043c \u0437\u0430\u043d\u044f\u0442\u0438\u0435\u043c.<\/p>\n<p>\u0425\u043e\u0442\u044f Kotlin \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u0432 <a href=\"https:\/\/kotlinlang.org\/docs\/tutorials\/javascript\/kotlin-to-javascript\/kotlin-to-javascript.html\"><strong><u>JavaScript<\/u><\/strong><\/a>, \u0430 \u0441\u043a\u043e\u0440\u043e \u0438 \u0432 <a href=\"https:\/\/blog.jetbrains.com\/kotlin\/2017\/04\/kotlinnative-tech-preview-kotlin-without-a-vm\/\"><strong><u>\u043c\u0430\u0448\u0438\u043d\u043d\u044b\u0439 \u043a\u043e\u0434<\/u><\/strong><\/a>, \u044f \u0441\u043e\u0441\u0440\u0435\u0434\u043e\u0442\u043e\u0447\u0443\u0441\u044c \u043d\u0430 \u0435\u0433\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0441\u0440\u0435\u0434\u0435 &#8212; <strong>JVM<\/strong>.<\/p>\n<p>\u0418\u0442\u0430\u043a, \u0432\u043e\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438\u0447\u0438\u043d, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0432\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043d\u0430 Kotlin (\u043d\u0443\u043c\u0435\u0440\u0430\u0446\u0438\u044f \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u0430, \u0431\u0435\u0437 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0430):<\/p>\n<p><strong>0# <\/strong><a href=\"https:\/\/kotlinlang.org\/docs\/reference\/java-interop.html\"><strong><u>\u0412\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441 Java<\/u><\/strong><\/a><\/p>\n<p>Kotlin \u043d\u0430 <strong>100% \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c \u0441 Java<\/strong>. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0432 \u0431\u0443\u043a\u0432\u0430\u043b\u044c\u043d\u043e\u043c \u0441\u043c\u044b\u0441\u043b\u0435 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0430\u0434 \u0441\u0432\u043e\u0438\u043c\u0438 \u0441\u0442\u0430\u0440\u044b\u043c\u0438 Java-\u043f\u0440\u043e\u0435\u043a\u0442\u0430\u043c\u0438, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f Kotlin. \u0412\u0441\u0435 \u0432\u0430\u0448\u0438 \u043b\u044e\u0431\u0438\u043c\u044b\u0435 <strong>Java-\u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0438<\/strong> <strong>\u043f\u043e-\u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b<\/strong>, \u0438 \u043b\u044e\u0431\u043e\u0439 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b \u043d\u0430\u043f\u0438\u0448\u0435\u0442\u0435 \u043d\u0430 Kotlin, \u0431\u0443\u0434\u0435\u0442 \u043b\u0435\u0433\u043a\u043e \u043f\u0440\u0438\u043d\u044f\u0442 \u0432\u0430\u0448\u0438\u043c \u0443\u043f\u0435\u0440\u0442\u044b\u043c \u0434\u0440\u0443\u0433\u043e\u043c, \u043b\u044e\u0431\u044f\u0449\u0438\u043c Java.<\/p>\n<p><strong>1# <\/strong><a href=\"https:\/\/kotlinlang.org\/docs\/reference\/basic-syntax.html\"><strong><u>\u0417\u043d\u0430\u043a\u043e\u043c\u044b\u0439 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441<\/u><\/strong><\/a><\/p>\n<p>Kotlin &#8212; \u044d\u0442\u043e \u043d\u0435 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043d\u0435\u043e\u0431\u044b\u0447\u043d\u044b\u0439 \u044f\u0437\u044b\u043a, \u0440\u043e\u0436\u0434\u0435\u043d\u043d\u044b\u0439 \u0432 \u0430\u043a\u0430\u0434\u0435\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043a\u0440\u0443\u0433\u0430\u0445. \u0415\u0433\u043e \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u0437\u043d\u0430\u043a\u043e\u043c \u043b\u044e\u0431\u043e\u043c\u0443 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0443, \u043f\u0440\u0438\u0448\u0435\u0434\u0448\u0435\u043c\u0443 \u0438\u0437 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Object-oriented_programming\"><u>\u041e\u041e\u041f<\/u><\/a>, \u0438 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u0438\u043b\u0438 \u043c\u0435\u043d\u0435\u0435 \u043f\u043e\u043d\u044f\u0442\u0435\u043d \u0441 \u0441\u0430\u043c\u043e\u0433\u043e \u043d\u0430\u0447\u0430\u043b\u0430. \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u0435\u0441\u0442\u044c <em>\u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 <\/em>\u043e\u0442\u043b\u0438\u0447\u0438\u044f \u043e\u0442 Java, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0435\u0440\u0435\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u044b\u0435 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u044b \u0438\u043b\u0438 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 <code>val<\/code> <code>var<\/code>. \u0412 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u043c \u043d\u0438\u0436\u0435 \u0441\u043d\u0438\u043f\u043f\u0435\u0442\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0430 \u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430:<\/p>\n<pre><code class=\"kotlin\">class Foo {      val b: String = \"b\"     \/\/ val means unmodifiable     var i: Int = 0          \/\/ var means modifiable      fun hello() {         val str = \"Hello\"         print(\"$str World\")     }      fun sum(x: Int, y: Int): Int {         return x + y     }      fun maxOf(a: Float, b: Float) = if (a > b) a else b  }<\/code><\/pre>\n<p><strong>2#<\/strong> <a href=\"https:\/\/kotlinlang.org\/docs\/reference\/basic-types.html#string-templates\"><strong><u>\u0418\u043d\u0442\u0435\u0440\u043f\u043e\u043b\u044f\u0446\u0438\u044f \u0441\u0442\u0440\u043e\u043a<\/u><\/strong><\/a><\/p>\n<p>\u042d\u0442\u043e \u043a\u0430\u043a \u0435\u0441\u043b\u0438 \u0431\u044b \u0432 \u044f\u0437\u044b\u043a \u0431\u044b\u043b\u0430 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u0430 \u0431\u043e\u043b\u0435\u0435 \u0443\u043c\u043d\u0430\u044f \u0438 \u0447\u0438\u0442\u0430\u0431\u0435\u043b\u044c\u043d\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>String.format()<\/code> \u0438\u0437 Java:<\/p>\n<pre><code class=\"kotlin\">val x = 4 val y = 7 print(\"sum of $x and $y is ${x + y}\")  \/\/ sum of 4 and 7 is 11<\/code><\/pre>\n<p><strong>3#<\/strong> <a href=\"https:\/\/kotlinlang.org\/docs\/reference\/properties.html\"><strong><u>\u0412\u044b\u0432\u043e\u0434 \u0442\u0438\u043f\u043e\u0432<\/u><\/strong><\/a><\/p>\n<p>Kotlin \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u0432\u0430\u0448\u0438 \u0442\u0438\u043f\u044b, \u0435\u0441\u043b\u0438 \u0432\u044b \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0435, \u0447\u0442\u043e \u044d\u0442\u043e \u0443\u043b\u0443\u0447\u0448\u0438\u0442 \u0447\u0438\u0442\u0430\u0431\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c:<\/p>\n<pre><code class=\"kotlin\">val a = \"abc\"                         \/\/ type inferred to String val b = 4                             \/\/ type inferred to Int  val c: Double = 0.7                   \/\/ type declared explicitly val d: List&lt;String> = ArrayList()     \/\/ type declared explicitly<\/code><\/pre>\n<p><strong>4#<\/strong> <a href=\"https:\/\/kotlinlang.org\/docs\/reference\/typecasts.html\"><strong><u>&#171;\u0423\u043c\u043d\u044b\u0435&#187; \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f. (Smart Casts)<\/u><\/strong><\/a><\/p>\n<p>\u041a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 Kotlin \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0435\u0442 \u0432\u0430\u0448\u0443 \u043b\u043e\u0433\u0438\u043a\u0443 \u0438 <strong>\u043f\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u043e\u0432<\/strong>, \u0447\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u0438\u0437\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043e\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a <code>instanceof<\/code> \u0438 \u044f\u0432\u043d\u044b\u0445 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0439:<\/p>\n<pre><code class=\"kotlin\">if (obj is String) {     print(obj.toUpperCase())     \/\/ obj is now known to be a String }<\/code><\/pre>\n<p><strong>5#<\/strong> <a href=\"https:\/\/kotlinlang.org\/docs\/reference\/equality.html\"><strong><u>\u0418\u043d\u0442\u0443\u0438\u0442\u0438\u0432\u043d\u044b\u0435 \u0440\u0430\u0432\u0435\u043d\u0441\u0442\u0432\u0430<\/u><\/strong><\/a><\/p>\n<p>\u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u0442\u044c \u044f\u0432\u043d\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c <code>equals()<\/code>, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 <code>==<\/code> \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043d\u043e\u0435 \u0440\u0430\u0432\u0435\u043d\u0441\u0442\u0432\u043e:<\/p>\n<pre><code class=\"kotlin\">val john1 = Person(\"John\") val john2 = Person(\"John\") john1 == john2    \/\/ true  (structural equality) john1 === john2   \/\/ false (referential equality)<\/code><\/pre>\n<p><strong>6#<\/strong> <a href=\"https:\/\/kotlinlang.org\/docs\/reference\/functions.html#default-arguments\"><strong><u>\u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e<\/u><\/strong><\/a><\/p>\n<p>\u041d\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0441 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430\u043c\u0438:<\/p>\n<pre><code class=\"kotlin\">fun build(title: String, width: Int = 800, height: Int = 600) {     Frame(title, width, height) }<\/code><\/pre>\n<p><strong>7#<\/strong> <a href=\"https:\/\/kotlinlang.org\/docs\/reference\/functions.html#named-arguments\"><strong><u>\u0418\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b<\/u><\/strong><\/a><\/p>\n<p>\u0412 \u0441\u043e\u0447\u0435\u0442\u0430\u043d\u0438\u0438 \u0441 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u0438\u0437\u0431\u0430\u0432\u043b\u044f\u044e\u0442 \u043e\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/en.wikipedia.org\/wiki\/Builder_pattern\"><u>\u0441\u0442\u0440\u043e\u0438\u0442\u0435\u043b\u0435\u0439 (builders)<\/u><\/a>:<\/p>\n<pre><code class=\"kotlin\">build(\"PacMan\", 400, 300)                           \/\/ equivalent build(title = \"PacMan\", width = 400, height = 300)  \/\/ equivalent build(width = 400, height = 300, title = \"PacMan\")  \/\/ equivalent<\/code><\/pre>\n<p><strong>8#<\/strong> <a href=\"https:\/\/kotlinlang.org\/docs\/reference\/control-flow.html#when-expression\"><strong><u>\u0412\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 When<\/u><\/strong><\/a><\/p>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0437\u0430\u043c\u0435\u043d\u044b \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0443 switch \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0431\u043e\u043b\u0435\u0435 \u0443\u0434\u043e\u0431\u043d\u043e\u0435 \u0438 \u0433\u0438\u0431\u043a\u043e\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 <em>when<\/em>:<\/p>\n<pre><code class=\"kotlin\">when (x) {     1 -> print(\"x is 1\")     2 -> print(\"x is 2\")     3, 4 -> print(\"x is 3 or 4\")     in 5..10 -> print(\"x is 5, 6, 7, 8, 9, or 10\")     else -> print(\"x is out of range\") }<\/code><\/pre>\n<p>\u041e\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043a\u0430\u043a \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435, \u0438 \u043a\u0430\u043a \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440, \u0441 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u043c, \u0438 \u0431\u0435\u0437 \u043d\u0435\u0433\u043e:<\/p>\n<pre><code class=\"kotlin\">val res: Boolean = when {     obj == null -> false     obj is String -> true     else -> throw IllegalStateException() }<\/code><\/pre>\n<p><strong>9#<\/strong> <a href=\"https:\/\/kotlinlang.org\/docs\/reference\/properties.html#getters-and-setters\"><strong><u>\u0421\u0432\u043e\u0439\u0441\u0442\u0432\u0430<\/u><\/strong><\/a><\/p>\n<p>\u041a \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u043c \u043f\u043e\u043b\u044f\u043c \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043e \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 set \u0438 get, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u043d\u0430\u043c \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0437\u0430\u0433\u0440\u043e\u043c\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u043a\u043e\u0434\u0430 \u0431\u0435\u0441\u0441\u043c\u044b\u0441\u043b\u0435\u043d\u043d\u044b\u043c\u0438 <a href=\"http:\/\/stackoverflow.com\/questions\/1568091\/why-use-getters-and-setters\"><u>\u0433\u0435\u0442\u0442\u0435\u0440\u0430\u043c\u0438 \u0438 \u0441\u0435\u0442\u0442\u0435\u0440\u0430\u043c\u0438<\/u><\/a>.<\/p>\n<pre><code class=\"kotlin\">class Frame {     var width: Int = 800     var height: Int = 600      val pixels: Int         get() = width * height }<\/code><\/pre>\n<p><strong>10#<\/strong> <a href=\"https:\/\/kotlinlang.org\/docs\/reference\/data-classes.html\"><strong><u>\u041a\u043b\u0430\u0441\u0441 \u0434\u0430\u043d\u043d\u044b\u0445 (Data Class)<\/u><\/strong><\/a><\/p>\n<p>\u042d\u0442\u043e POJO (Plain Old Java Object) \u0441 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438 <code>toString()<\/code>, <code>equals()<\/code>, <code>hashCode()<\/code> \u0438 <code>copy()<\/code>, \u0438 \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 Java \u043e\u043d \u043d\u0435 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u043f\u043e\u0447\u0442\u0438 100 \u0441\u0442\u0440\u043e\u043a \u043a\u043e\u0434\u0430:<\/p>\n<pre><code class=\"kotlin\">data class Person(val name: String,                   var email: String,                   var age: Int)  val john = Person(\"John\", \"john@gmail.com\", 112)<\/code><\/pre>\n<p><strong>11#<\/strong> <a href=\"https:\/\/kotlinlang.org\/docs\/reference\/operator-overloading.html\"><strong><u>\u041f\u0435\u0440\u0435\u0433\u0440\u0443\u0437\u043a\u0430 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430<\/u><\/strong><\/a><\/p>\n<p>\u041f\u0440\u0435\u0434\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0436\u0435\u043d \u0434\u043b\u044f \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044f \u0447\u0438\u0442\u0430\u0431\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438:<\/p>\n<pre><code class=\"kotlin\">data class Vec(val x: Float, val y: Float) {     operator fun plus(v: Vec) = Vec(x + v.x, y + v.y) }  val v = Vec(2f, 3f) + Vec(4f, 1f)<\/code><\/pre>\n<p><strong>12#<\/strong> <a href=\"https:\/\/kotlinlang.org\/docs\/reference\/multi-declarations.html\"><strong><u>\u041e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u0435\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0438\u0437\u0430\u0446\u0438\u0438<\/u><\/strong><\/a><\/p>\n<p>\u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0434\u0435\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u044b, \u0447\u0442\u043e, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u0434\u043b\u044f \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u043a\u0430\u0440\u0442:<\/p>\n<pre><code class=\"kotlin\">for ((key, value) in map) {     print(\"Key: $key\")     print(\"Value: $value\") }<\/code><\/pre>\n<p><strong>13#<\/strong> <a href=\"https:\/\/kotlinlang.org\/docs\/reference\/ranges.html\"><strong><u>\u0414\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u044b<\/u><\/strong><\/a><\/p>\n<p>\u0414\u043b\u044f \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044f \u0447\u0438\u0442\u0430\u0431\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438:<\/p>\n<pre><code class=\"kotlin\">for (i in 1..100) { ... }  for (i in 0 until 100) { ... } for (i in 2..10 step 2) { ... }  for (i in 10 downTo 1) { ... }  if (x in 1..10) { ... }<\/code><\/pre>\n<p><strong>14#<\/strong> <a href=\"https:\/\/kotlinlang.org\/docs\/reference\/extensions.html\"><strong><u>\u0424\u0443\u043d\u043a\u0446\u0438\u0438 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f<\/u><\/strong><\/a><\/p>\n<p>\u041f\u043e\u043c\u043d\u0438\u0442\u0435, \u043a\u043e\u0433\u0434\u0430 \u0432\u0430\u043c \u0432\u043f\u0435\u0440\u0432\u044b\u0435 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u043b\u043e\u0441\u044c \u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c <code>List<\/code> \u0432 Java? \u0412\u044b \u043d\u0435 \u043c\u043e\u0433\u043b\u0438 \u043d\u0430\u0439\u0442\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044e <code>sort()<\/code> \u0438 \u0432\u0430\u043c \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0443\u0437\u043d\u0430\u0442\u044c \u043e <code>Collections.sort()<\/code>. \u0410 \u043f\u043e\u0437\u0436\u0435, \u043a\u043e\u0433\u0434\u0430 \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c <code>String<\/code> \u0441 \u0437\u0430\u0433\u043b\u0430\u0432\u043d\u043e\u0439 \u0431\u0443\u043a\u0432\u044b, \u0442\u043e \u044d\u0442\u043e \u043f\u0440\u0438\u0432\u0435\u043b\u043e \u043a \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044e \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0432\u044b \u043d\u0435 \u0437\u043d\u0430\u043b\u0438 \u043e <code>StringUtils.capitalize()<\/code>.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0431\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u043b \u0441\u043f\u043e\u0441\u043e\u0431 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u043e\u0432\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432 \u0441\u0442\u0430\u0440\u044b\u0435 \u043a\u043b\u0430\u0441\u0441\u044b; \u0442\u043e\u0433\u0434\u0430 \u0432\u0430\u0448\u0430 IDE \u0441\u043c\u043e\u0433\u043b\u0430 \u0431\u044b \u043f\u043e\u043c\u043e\u0447\u044c \u0432\u0430\u043c \u043d\u0430\u0439\u0442\u0438 \u043d\u0443\u0436\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043f\u0440\u0438 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u043c \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u043a\u043e\u0434\u0430. \u0412 Kotlin \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0438\u043c\u0435\u043d\u043d\u043e \u044d\u0442\u043e:<\/p>\n<pre><code class=\"kotlin\">fun String.replaceSpaces(): String {     return this.replace(' ', '_') }  val formatted = str.replaceSpaces()<\/code><\/pre>\n<p>\u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 Java, \u0447\u0442\u043e \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b\u043e\u0441\u044c \u0434\u043b\u044f <code>String<\/code>:<\/p>\n<pre><code class=\"kotlin\">str.removeSuffix(\".txt\") str.capitalize() str.substringAfterLast(\"\/\") str.replaceAfter(\":\", \"classified\")<\/code><\/pre>\n<p><strong>15#<\/strong> <a href=\"https:\/\/kotlinlang.org\/docs\/reference\/null-safety.html\"><strong><u>Null \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c<\/u><\/strong><\/a><\/p>\n<p>Java &#8212; \u044d\u0442\u043e \u0442\u043e, \u0447\u0442\u043e \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043d\u0430\u0437\u0432\u0430\u0442\u044c <em>\u043f\u043e\u0447\u0442\u0438<\/em> \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0442\u0438\u043f\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u044f\u0437\u044b\u043a\u043e\u043c. \u0412 \u043d\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u0442\u0438\u043f\u0430 <code>String<\/code> \u043d\u0435 <em>\u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e <\/em>\u0441\u0441\u044b\u043b\u0430\u0435\u0442\u0441\u044f \u043d\u0430 <code>String<\/code> &#8212; \u043e\u043d\u0430 \u043c\u043e\u0436\u0435\u0442 \u0441\u0441\u044b\u043b\u0430\u0442\u044c\u0441\u044f \u043d\u0430 <code>null<\/code>. \u041d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u043c\u044b \u043f\u0440\u0438\u0432\u044b\u043a\u043b\u0438 \u043a \u044d\u0442\u043e\u043c\u0443, \u044d\u0442\u043e \u0441\u0432\u043e\u0434\u0438\u0442 \u043d\u0430 \u043d\u0435\u0442 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0442\u0438\u043f\u043e\u0432, \u0438 \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c Java \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0436\u0438\u0442\u044c \u0432 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e\u043c \u0441\u0442\u0440\u0430\u0445\u0435 \u043f\u0435\u0440\u0435\u0434 \u043e\u0448\u0438\u0431\u043a\u043e\u0439 <a href=\"http:\/\/stackoverflow.com\/questions\/218384\/what-is-a-nullpointerexception-and-how-do-i-fix-it\"><u>NPE<\/u><\/a> (<code>NullPointerException<\/code>).<\/p>\n<p>Kotlin \u0440\u0435\u0448\u0430\u0435\u0442 \u044d\u0442\u0443 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443, \u043f\u0440\u043e\u0432\u043e\u0434\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 <strong>\u043d\u0435\u043d\u0443\u043b\u0435\u0432\u044b\u043c\u0438 (non-null<\/strong>) \u0438\u00a0 <strong>\u043e\u0431\u043d\u0443\u043b\u044f\u0435\u043c\u044b\u043c\u0438 (nullable) \u0442\u0438\u043f\u0430\u043c\u0438<\/strong>. \u0422\u0438\u043f\u044b \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f non-null, \u0438 \u0438\u0445 \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c nullable, \u0434\u043e\u0431\u0430\u0432\u0438\u0432 <code>?<\/code> \u043a\u0430\u043a, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code class=\"kotlin\">var a: String = \"abc\" a = null                \/\/ compile error  var b: String? = \"xyz\" b = null                \/\/ no problem<\/code><\/pre>\n<p>Kotlin \u0437\u0430\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0432\u0430\u0441 \u0437\u0430\u0449\u0438\u0449\u0430\u0442\u044c\u0441\u044f \u043e\u0442 NPE \u0432\u0441\u044f\u043a\u0438\u0439 \u0440\u0430\u0437, \u043a\u043e\u0433\u0434\u0430 \u0432\u044b \u043e\u0431\u0440\u0430\u0449\u0430\u0435\u0442\u0435\u0441\u044c \u043a nullable-\u0442\u0438\u043f\u0443:<\/p>\n<pre><code>val x = b.length        \/\/ compile error: b might be null<\/code><\/pre>\n<p>\u0418 \u0445\u043e\u0442\u044f \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u0433\u0440\u043e\u043c\u043e\u0437\u0434\u043a\u0438\u043c, \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0432\u0441\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044f\u043c Kotlin. \u0423 \u043d\u0430\u0441 \u0432\u0441\u0435 \u0435\u0449\u0435 \u0435\u0441\u0442\u044c \u0443\u043c\u043d\u043e\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u0442 nullable \u0442\u0438\u043f\u044b \u0432 non-null \u0432\u0435\u0437\u0434\u0435, \u0433\u0434\u0435 \u044d\u0442\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e:<\/p>\n<pre><code>if (b == null) return val x = b.length        \/\/ no problem<\/code><\/pre>\n<p>\u041c\u044b \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 <code>?.<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u043d\u0430 \u043d\u0443\u043b\u0435\u0432\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432\u043c\u0435\u0441\u0442\u043e \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0432\u044b\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0442\u044c NPE:<\/p>\n<pre><code>val x = b?.length       \/\/ type of x is nullable Int<\/code><\/pre>\n<p>\u0411\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u0435 \u0432\u044b\u0437\u043e\u0432\u044b \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u0442\u044c \u0432 \u0446\u0435\u043f\u043e\u0447\u043a\u0438, \u0447\u0442\u043e\u0431\u044b \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a if-not-null (\u0435\u0441\u043b\u0438-\u043d\u0435-\u043d\u043e\u043b\u044c), \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u0438\u043d\u043e\u0433\u0434\u0430 \u043f\u0438\u0448\u0435\u043c \u0432 \u0434\u0440\u0443\u0433\u0438\u0445 \u044f\u0437\u044b\u043a\u0430\u0445, \u0438 \u0435\u0441\u043b\u0438 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, \u043e\u0442\u043b\u0438\u0447\u043d\u043e\u0435 \u043e\u0442 <code>null<\/code>, \u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c elvis-\u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 <code>?:<\/code>:<\/p>\n<pre><code>val name = ship?.captain?.name ?: \"unknown\"<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u043d\u0438\u0447\u0435\u0433\u043e \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u0432\u0430\u043c \u043d\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442, \u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0432 NPE \u043a\u0440\u0430\u0439\u043d\u0435 \u0432\u0435\u043b\u0438\u043a\u0430, \u0442\u043e \u0441\u043a\u0430\u0436\u0438\u0442\u0435 \u043e\u0431 \u044d\u0442\u043e\u043c \u044f\u0432\u043d\u043e:<\/p>\n<pre><code>val x = b?.length ?: throw NullPointerException()  \/\/ same as below val x = b!!.length                                 \/\/ same as above<\/code><\/pre>\n<p><strong>16# <\/strong><a href=\"https:\/\/kotlinlang.org\/docs\/reference\/lambdas.html\"><strong><u>\u0423\u043b\u0443\u0447\u0448\u0435\u043d\u043d\u044b\u0435 \u043b\u044f\u043c\u0431\u0434\u044b<\/u><\/strong><\/a><\/p>\n<p>\u042d\u0442\u043e \u0445\u043e\u0440\u043e\u0448\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043b\u044f\u043c\u0431\u0434 &#8212; \u043e\u043d\u0430 \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u043e \u0441\u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u043c\u0435\u0436\u0434\u0443 \u0447\u0438\u0442\u0430\u0431\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e \u0438 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c\u044e, \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u043f\u0440\u043e\u0434\u0443\u043c\u0430\u043d\u043d\u043e\u043c\u0443 \u0434\u0438\u0437\u0430\u0439\u043d\u0443, \u0441 \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u043e\u043c:<\/p>\n<pre><code class=\"kotlin\">val sum = { x: Int, y: Int -> x + y }   \/\/ type: (Int, Int) -> Int val res = sum(4,7)                      \/\/ res == 11<\/code><\/pre>\n<p>\u0410 \u0432\u043e\u0442 \u0438 \u0442\u043e\u043b\u043a\u043e\u0432\u044b\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f:<\/p>\n<ol>\n<li>\n<p>\u0421\u043a\u043e\u0431\u043a\u0438 \u043c\u0435\u0442\u043e\u0434\u0430 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u044b \u0438\u043b\u0438 \u043e\u043f\u0443\u0449\u0435\u043d\u044b, \u0435\u0441\u043b\u0438 \u043b\u044f\u043c\u0431\u0434\u0430 \u0438\u0434\u0435\u0442 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u043b\u0438\u0431\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u043c \u043c\u0435\u0442\u043e\u0434\u0430.<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u043c\u044b \u0440\u0435\u0448\u0438\u043b\u0438 \u043d\u0435 \u043e\u0431\u044a\u044f\u0432\u043b\u044f\u0442\u044c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u043e\u0434\u043d\u043e\u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043d\u043e\u0439 \u043b\u044f\u043c\u0431\u0434\u044b, \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u043d\u0435\u044f\u0432\u043d\u043e \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d \u043f\u043e\u0434 \u0438\u043c\u0435\u043d\u0435\u043c <code>it<\/code>.<\/p>\n<\/li>\n<\/ol>\n<p>\u042d\u0442\u0438 \u0444\u0430\u043a\u0442\u044b \u0432 \u0441\u043e\u0432\u043e\u043a\u0443\u043f\u043d\u043e\u0441\u0442\u0438 \u0434\u0435\u043b\u0430\u044e\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0442\u0440\u0438 \u0441\u0442\u0440\u043e\u043a\u0438 \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u043d\u044b\u043c\u0438:<\/p>\n<pre><code class=\"kotlin\">numbers.filter({ x -> x.isPrime() }) numbers.filter { x -> x.isPrime() } numbers.filter { it.isPrime() }<\/code><\/pre>\n<p>\u0418 \u044d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0430\u043c \u043f\u0438\u0441\u0430\u0442\u044c \u043b\u0430\u043a\u043e\u043d\u0438\u0447\u043d\u044b\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u0434 &#8212; \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u043d\u0430 \u044d\u0442\u0443 \u043a\u0440\u0430\u0441\u043e\u0442\u0443:<\/p>\n<pre><code class=\"kotlin\">persons     .filter { it.age >= 18 }     .sortedBy { it.name }     .map { it.email }     .forEach { print(it) }<\/code><\/pre>\n<p>\u0421\u0438\u0441\u0442\u0435\u043c\u0430 \u043b\u044f\u043c\u0431\u0434 Kotlin \u0432 \u0441\u043e\u0447\u0435\u0442\u0430\u043d\u0438\u0438 \u0441 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u0434\u0435\u043b\u0430\u0435\u0442 \u0435\u0433\u043e \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u044b\u043c \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f <a href=\"https:\/\/en.wikipedia.org\/wiki\/Domain-specific_language\"><u>DSL<\/u><\/a>. \u0412\u0437\u0433\u043b\u044f\u043d\u0438\u0442\u0435 \u043d\u0430 <a href=\"https:\/\/github.com\/Kotlin\/anko\"><u>Anko<\/u><\/a> \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 DSL, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0438\u0437\u0432\u0430\u043d \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0443 Android:<\/p>\n<pre><code class=\"kotlin\">verticalLayout {     padding = dip(30)     editText {         hint = \u201cName\u201d         textSize = 24f     }     editText {         hint = \u201cPassword\u201d         textSize = 24f     }     button(\u201cLogin\u201d) {         textSize = 26f     } }<\/code><\/pre>\n<p><strong>17#<\/strong> <a href=\"https:\/\/kotlinlang.org\/docs\/tutorials\/getting-started.html\"><strong><u>\u041f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 IDE<\/u><\/strong><\/a><\/p>\n<p>\u0423 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432, \u0435\u0441\u043b\u0438 \u0432\u044b \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442\u0435\u0441\u044c \u043d\u0430\u0447\u0430\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 Kotlin, \u043d\u043e \u044f \u043d\u0430\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <strong>IntelliJ<\/strong>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 <strong>\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432 \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0442\u0435 \u0441 Kotlin<\/strong> &#8212; \u0435\u0433\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u0443\u044e\u0442 \u0432\u0441\u0435 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0438 \u044f\u0437\u044b\u043a, \u0438 IDE \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043e\u0434\u043d\u0438\u043c\u0438 \u0438 \u0442\u0435\u043c\u0438 \u0436\u0435 \u043b\u044e\u0434\u044c\u043c\u0438.<\/p>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e, \u043d\u043e \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430, \u0432\u043e\u0442 \u0447\u0442\u043e \u0432\u0441\u043f\u043b\u044b\u043b\u043e, \u043a\u043e\u0433\u0434\u0430 \u044f \u0432\u043f\u0435\u0440\u0432\u044b\u0435 \u043f\u043e\u043f\u044b\u0442\u0430\u043b\u0441\u044f \u0441\u043a\u043e\u043f\u0438\u043f\u0430\u0441\u0442\u0438\u0442\u044c Java-\u043a\u043e\u0434 \u0441\u043e Stack Overflow:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>IntelliJ \u0437\u0430\u043c\u0435\u0442\u0438\u0442, \u0435\u0441\u043b\u0438 \u0432\u044b \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u0435 Java-\u043a\u043e\u0434 \u0432 \u0444\u0430\u0439\u043b Kotlin<\/p>\n<hr\/>\n<blockquote>\n<p>\u0417\u0430\u0432\u0442\u0440\u0430 \u0441\u043e\u0441\u0442\u043e\u0438\u0442\u0441\u044f \u043e\u0442\u043a\u0440\u044b\u0442\u043e\u0435 \u0437\u0430\u043d\u044f\u0442\u0438\u0435 <strong>\u00ab\u041e\u0441\u043d\u043e\u0432\u044b \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432\u00bb<\/strong>, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043c\u044b \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u044b \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0438 \u0438\u0445<\/p>\n<\/blockquote>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-338585","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/338585","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=338585"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/338585\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=338585"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=338585"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=338585"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}