{"id":347132,"date":"2023-03-23T09:01:59","date_gmt":"2023-03-23T09:01:59","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=347132"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=347132","title":{"rendered":"<span>\u041f\u043e\u043b\u043d\u043e\u0435 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e \u043f\u043e\u00a0switch \u0432\u00a0Java<\/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<h3>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h3>\n<p>\u0421\u0442\u0430\u0440\u044b\u0439 \u0434\u043e\u0431\u0440\u044b\u0439 <em>switch <\/em>\u0431\u044b\u043b \u0432\u00a0Java \u0441\u00a0\u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0434\u043d\u044f. \u041c\u044b \u0432\u0441\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0435\u0433\u043e \u0438 \u043f\u0440\u0438\u0432\u044b\u043a\u043b\u0438 \u043a\u00a0\u043d\u0435\u043c\u0443\u00a0\u2014 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u043a\u00a0\u0435\u0433\u043e \u043f\u0440\u0438\u0447\u0443\u0434\u0430\u043c (\u043a\u043e\u0433\u043e\u2011\u043d\u0438\u0431\u0443\u0434\u044c \u0435\u0449\u0435 \u0440\u0430\u0437\u0434\u0440\u0430\u0436\u0430\u0435\u0442 <em>break<\/em>?). \u041d\u043e\u00a0\u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 <a href=\"https:\/\/openjdk.org\/jeps\/325\" rel=\"noopener noreferrer nofollow\">Java 12<\/a>, \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f: <em>switch <\/em>\u0432\u043c\u0435\u0441\u0442\u043e \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u0441\u0442\u0430\u043b \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435\u043c: <\/p>\n<pre><code class=\"java\">boolean result = switch(ternaryBool) {     case TRUE -> true;     case FALSE -> false;     case FILE_NOT_FOUND -> throw new UncheckedIOException(         \"This is ridiculous!\",         new FileNotFoundException());     default -> throw new IllegalArgumentException(\"Seriously?!\"); }<\/code><\/pre>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0440\u0430\u0431\u043e\u0442\u044b switch\u2011\u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0442\u0435\u043f\u0435\u0440\u044c<em> <\/em>\u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u0432\u00a0\u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e; \u0443\u0448\u043b\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <em>break<\/em> \u0432\u00a0\u043a\u0430\u0436\u0434\u043e\u0439 \u0432\u0435\u0442\u043a\u0435 <em>case <\/em>\u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u043b\u044f\u043c\u0431\u0434\u0430\u2011\u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0443 \u0438 \u043c\u043d\u043e\u0433\u043e\u0435 \u0434\u0440\u0443\u0433\u043e\u0435. <\/p>\n<p>\u041a\u043e\u0433\u0434\u0430 \u0434\u0435\u043b\u043e \u0434\u043e\u0445\u043e\u0434\u0438\u0442 \u0434\u043e <em>switch <\/em>\u043f\u043e\u0441\u043b\u0435 Java 14, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0441\u0442\u0438\u043b\u044c \u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f:<\/p>\n<ul>\n<li>\n<p>\u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 \u0438\u043b\u0438\u00a0\u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 (\u0441 Java 14)<\/p>\n<\/li>\n<li>\n<p>\u0434\u0432\u043e\u0435\u0442\u043e\u0447\u0438\u044f \u0438\u043b\u0438\u00a0\u0441\u0442\u0440\u0435\u043b\u043a\u0438 (\u0441 Java 14)<\/p>\n<\/li>\n<li>\n<p>\u043c\u0435\u0442\u043a\u0438 \u0438\u043b\u0438\u00a0\u0448\u0430\u0431\u043b\u043e\u043d\u044b (3-\u0439 \u043f\u0440\u0435\u0432\u044c\u044e \u0432\u00a0Java 19)<\/p>\n<\/li>\n<\/ul>\n<p>\u0412\u00a0\u044d\u0442\u043e\u043c \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0435 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043e\u0431\u043e\u00a0\u0432\u0441\u0435\u043c, \u0447\u0442\u043e\u00a0\u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0437\u043d\u0430\u0442\u044c \u043e\u00a0switch\u2011\u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u0445, \u0438 \u043a\u0430\u043a\u00a0\u0438\u0445 \u043b\u0443\u0447\u0448\u0435 \u0432\u0441\u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u00a0\u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 Java. <\/p>\n<h3>\u041d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0438 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 switch<\/h3>\n<p>\u041f\u0440\u0435\u0436\u0434\u0435, \u0447\u0435\u043c \u043c\u044b \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043a\u00a0\u043e\u0431\u0437\u043e\u0440\u0443 \u043d\u043e\u0432\u043e\u0432\u0432\u0435\u0434\u0435\u043d\u0438\u0439, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043e\u0434\u0438\u043d \u043f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u0434\u0430. \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u043c\u044b \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0438\u0441\u044c \u0441 \u00ab\u0443\u0436\u0430\u0441\u043d\u044b\u043c\u00bb <a href=\"https:\/\/thedailywtf.com\/articles\/What_Is_Truth_0x3f_\" rel=\"noopener noreferrer nofollow\">\u0442\u0435\u0440\u043d\u0430\u0440\u043d\u044b\u043c boolean<\/a> \u0438 \u0445\u043e\u0442\u0438\u043c \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0432\u00a0\u043e\u0431\u044b\u0447\u043d\u044b\u0439 boolean. \u0412\u043e\u0442 \u043e\u0434\u0438\u043d \u0438\u0437\u00a0\u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e: <\/p>\n<pre><code class=\"java\">boolean result; switch(ternaryBool) {     case TRUE:         result = true;         break;     case FALSE:         result = false;         break;     case FILE_NOT_FOUND:         \/\/ \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0434\u043b\u044f \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0432 default         var ex = new UncheckedIOException(\"This is ridiculous!\",              new FileNotFoundException());         throw ex;     default:         \/\/ \u0410 \u0432\u043e\u0442 \u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430: \u043c\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u043e\u0431\u044a\u044f\u0432\u0438\u0442\u044c \u0435\u0449\u0435 \u043e\u0434\u043d\u0443 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0441 \u0438\u043c\u0435\u043d\u0435\u043c ex         var ex2 = new IllegalArgumentException(\"Seriously?!\");         throw ex2; }<\/code><\/pre>\n<p>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u0445\u0440\u043e\u043c\u0430\u0435\u0442: \u043d\u0430\u043b\u0438\u0447\u0438\u0435 <em>break <\/em>\u0432\u00a0\u043a\u0430\u0436\u0434\u043e\u0439 \u0432\u0435\u0442\u043a\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043b\u0435\u0433\u043a\u043e \u0437\u0430\u0431\u044b\u0442\u044c; \u043c\u043e\u0436\u043d\u043e \u043d\u0435\u00a0\u0443\u0447\u0435\u0441\u0442\u044c \u0432\u0441\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f <em>ternaryBool<\/em> (\u0437\u0430\u0431\u044b\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u043a\u043e\u0439\u2011\u0442\u043e <em>case<\/em>); \u0441\u00a0\u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 <em>result<\/em>  \u043d\u0435\u00a0\u0432\u0441\u0435 \u0433\u043b\u0430\u0434\u043a\u043e\u00a0\u2014 \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043d\u0435\u00a0\u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0435\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044e; \u043d\u0435\u043b\u044c\u0437\u044f \u043e\u0431\u044a\u044f\u0432\u0438\u0442\u044c \u0432\u00a0\u0440\u0430\u0437\u043d\u044b\u0445 \u0432\u0435\u0442\u043a\u0430\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0441\u00a0\u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u043c \u0438\u043c\u0435\u043d\u0435\u043c. \u0421\u043e\u0433\u043b\u0430\u0441\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e\u00a0\u0434\u0430\u043d\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043a\u0440\u0430\u0439\u043d\u0435 \u0433\u0440\u043e\u043c\u043e\u0437\u0434\u043a\u043e \u0438 \u043d\u0435\u0443\u0434\u043e\u0431\u043d\u043e\u00a0\u2014 \u0442\u0443\u0442 \u044f\u0432\u043d\u043e \u0435\u0441\u0442\u044c, \u0447\u0442\u043e\u00a0\u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c.<\/p>\n<p>\u0410\u00a0\u0432\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u043e\u043f\u0440\u043e\u0449\u0435, \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u0443\u044e\u0449\u0438\u0439 \u043f\u043e\u0445\u043e\u0436\u0438\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b:<\/p>\n<pre><code class=\"java\">int result; switch (number) {     case 1:         result = callMethod(\"one\");         break;     case 2:         result = callMethod(\"two\");         break;     default:         result = callMethod(\"many\");         break; }<\/code><\/pre>\n<p> \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0443\u0441\u0442\u0440\u0430\u043d\u0438\u0442\u044c \u0432\u0441\u0435 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0438, \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0432 <em>switch <\/em>\u0432\u00a0\u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434: <\/p>\n<pre><code class=\"java\">private static boolean toBoolean(Bool ternaryBool) {     switch(ternaryBool) {         case TRUE: return true;         case FALSE: return false;         case FILE_NOT_FOUND:             throw new UncheckedIOException(\"This is ridiculous!\",                   new FileNotFoundException());         \/\/ \u0431\u0435\u0437 default \u043c\u0435\u0442\u043e\u0434 \u043d\u0435 \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f         default:             throw new IllegalArgumentException(\"Seriously?!\");       } }<\/code><\/pre>\n<p>\u0422\u0430\u043a \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u043b\u0443\u0447\u0448\u0435: \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0444\u0438\u043a\u0442\u0438\u0432\u043d\u0430\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f <em>result<\/em>, \u043d\u0435\u0442 <em>break<\/em>, \u0437\u0430\u0433\u0440\u043e\u043c\u043e\u0436\u0434\u0430\u044e\u0449\u0438\u0445 \u043a\u043e\u0434 \u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430 \u043e\u0431\u00a0\u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0438 <em>default <\/em>(\u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0432\u00a0\u044d\u0442\u043e\u043c \u043d\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438, \u043a\u0430\u043a\u00a0\u0432\u00a0\u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435). <\/p>\n<p>\u041d\u043e\u00a0\u0435\u0441\u043b\u0438 \u043f\u043e\u0434\u0443\u043c\u0430\u0442\u044c, \u0442\u043e \u043c\u044b \u043d\u0435\u00a0\u043e\u0431\u044f\u0437\u0430\u043d\u044b \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f\u00a0\u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043e\u0431\u043e\u0439\u0442\u0438 \u043d\u0435\u0443\u043a\u043b\u044e\u0436\u0443\u044e \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u044f\u0437\u044b\u043a\u0430. \u0418 \u044d\u0442\u043e \u0434\u0430\u0436\u0435 \u0431\u0435\u0437\u00a0\u0443\u0447\u0451\u0442\u0430, \u0447\u0442\u043e\u00a0\u0442\u0430\u043a\u043e\u0439 \u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u043d\u0433 \u043d\u0435\u00a0\u0432\u0441\u0435\u0433\u0434\u0430 \u0432\u043e\u0437\u043c\u043e\u0436\u0435\u043d. \u041d\u0435\u0442, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u0443\u0447\u0448\u0435!<\/p>\n<h3>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c switch-\u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f!  <\/h3>\n<p>\u041d\u0430\u0447\u0438\u043d\u0430\u044f \u0441\u00a0Java 12\u00a0\u0438 \u0432\u044b\u0448\u0435, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0440\u0435\u0448\u0438\u0442\u044c \u0432\u044b\u0448\u0435\u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c: <\/p>\n<pre><code class=\"java\">boolean result = switch(ternaryBool) {     case TRUE -> true;     case FALSE -> false;     case FILE_NOT_FOUND -> throw new UncheckedIOException(         \"This is ridiculous!\",         new FileNotFoundException());     \/\/ \u0432 \u0432\u0435\u0442\u043a\u0435 `default` \u0443\u0436\u0435 \u043d\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438     default -> throw new IllegalArgumentException(\"Seriously?!\"); }<\/code><\/pre>\n<p>\u042f \u0434\u0443\u043c\u0430\u044e, \u0447\u0442\u043e\u00a0\u044d\u0442\u043e \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e: \u0435\u0441\u043b\u0438 <em>ternartBool <\/em>\u0440\u0430\u0432\u0435\u043d <em>TRUE<\/em>, \u0442\u043e <em>result<\/em> \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u0441\u0432\u043e\u0435\u043d\u043e <em>true, \u0430<\/em> <em>FALSE <\/em>\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f <em>false<\/em>. <\/p>\n<p>\u0421\u0440\u0430\u0437\u0443 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0442 \u0434\u0432\u0435 \u043c\u044b\u0441\u043b\u0438:<\/p>\n<ul>\n<li>\n<p><em>switch <\/em>\u0442\u0435\u043f\u0435\u0440\u044c<em> <\/em>\u043c\u043e\u0436\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442<\/p>\n<\/li>\n<li>\n<p>\u043a\u0430\u043a\u0438\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0441\u0442\u0440\u0435\u043b\u043a\u0438? <\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u0443\u0433\u043b\u0443\u0431\u043b\u044f\u0442\u044c\u0441\u044f \u0432\u00a0\u0434\u0435\u0442\u0430\u043b\u0438 \u043d\u043e\u0432\u044b\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439, \u0432\u043d\u0430\u0447\u0430\u043b\u0435 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043e\u0431\u00a0\u044d\u0442\u0438\u0445 \u0434\u0432\u0443\u0445 \u0430\u0441\u043f\u0435\u043a\u0442\u0430\u0445. <\/p>\n<h3>\u0412\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 vs \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430  <\/h3>\n<p>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0432\u044b \u0443\u0434\u0438\u0432\u043b\u0435\u043d\u044b, \u0447\u0442\u043e <em>switch <\/em>\u0442\u0435\u043f\u0435\u0440\u044c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435\u043c. \u0410\u00a0\u0447\u0435\u043c\u00a0\u0436\u0435 \u043e\u043d\u00a0\u0431\u044b\u043b \u0434\u043e\u00a0\u044d\u0442\u043e\u0433\u043e? \u0414\u043e\u00a0Java 12\u00a0<em>switch <\/em>\u0431\u044b\u043b \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u043c\u00a0\u2014 \u0438\u043c\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0435\u0439, \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0435\u0439 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u044e\u0449\u0438\u043c \u043f\u043e\u0442\u043e\u043a\u043e\u043c.<\/p>\n<p>\u0414\u0443\u043c\u0430\u0439\u0442\u0435 \u043e\u00a0\u0440\u0430\u0437\u043b\u0438\u0447\u0438\u044f\u0445 \u0441\u0442\u0430\u0440\u043e\u0439 \u0438 \u043d\u043e\u0432\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 <em>switch<\/em>, \u043a\u0430\u043a\u00a0\u043e\u00a0\u0440\u0430\u0437\u043d\u0438\u0446\u0435 \u043c\u0435\u0436\u0434\u0443 <em>if<\/em> \u0438 <em>\u0442\u0435\u0440\u043d\u0430\u0440\u043d\u044b\u043c \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u043c<\/em>. \u041e\u043d\u0438 \u043e\u0431\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e\u0442 \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442 \u0442\u0443 \u0438\u043b\u0438\u00a0\u0438\u043d\u0443\u044e \u0432\u0435\u0442\u043a\u0443 \u0432\u00a0\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442\u00a0\u0435\u0433\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430.<\/p>\n<p>\u0420\u0430\u0437\u043d\u0438\u0446\u0430 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0432\u00a0\u0442\u043e\u043c, \u0447\u0442\u043e <em>if<\/em> \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u0431\u043b\u043e\u043a, \u0442\u043e\u0433\u0434\u0430 \u043a\u0430\u043a <em>\u0442\u0435\u0440\u043d\u0430\u0440\u043d\u044b\u0439 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440<\/em> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043a\u0430\u043a\u043e\u0439\u2011\u0442\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:<\/p>\n<pre><code class=\"java\">if(condition) {     result = doThis(); } else {     result = doThat(); }  result = condition ? doThis() : doThat();<\/code><\/pre>\n<p>\u0422\u043e\u00a0\u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u0438 \u0443 <em>switch<\/em>: \u0434\u043e\u00a0Java 12, \u0435\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0435\u043b\u0438 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442, \u0442\u043e \u0434\u043e\u043b\u0436\u043d\u044b\u00a0\u0431\u044b\u043b\u0438\u00a0\u043b\u0438\u0431\u043e \u043f\u0440\u0438\u0441\u0432\u043e\u0438\u0442\u044c \u0435\u0433\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439,\u00a0\u043b\u0438\u0431\u043e \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0438\u0437\u00a0\u043c\u0435\u0442\u043e\u0434\u0430, \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0434\u043b\u044f\u00a0\u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 <em>switch<\/em>. <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c\u00a0\u0436\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 <em>switch <\/em>\u043c\u043e\u0436\u0435\u0442\u00a0\u0431\u044b\u0442\u044c \u043f\u0440\u0438\u0441\u0432\u043e\u0435\u043d \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439.<\/p>\n<p>\u0415\u0449\u0435 \u043e\u0434\u043d\u043e \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432\u00a0\u0442\u043e\u043c, \u0447\u0442\u043e\u00a0\u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0447\u0430\u0441\u0442\u044c\u044e \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430, \u0442\u043e \u043e\u043d\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u0442\u043e\u0447\u043a\u043e\u0439 \u0441\u00a0\u0437\u0430\u043f\u044f\u0442\u043e\u0439, \u0432\u00a0\u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442\u00a0\u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 <em>switch<\/em><\/p>\n<h2>\u0421\u0442\u0440\u0435\u043b\u043a\u0430 vs \u0434\u0432\u043e\u0435\u0442\u043e\u0447\u0438\u044f<\/h2>\n<p>\u0412\u00a0\u0441\u0430\u043c\u043e\u043c \u043d\u0430\u0447\u0430\u043b\u0435 \u0441\u0442\u0430\u0442\u044c\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f \u043f\u0440\u0438\u043c\u0435\u0440 \u0441\u00a0\u043d\u043e\u0432\u044b\u043c \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u043e\u043c \u0432\u00a0\u043b\u044f\u043c\u0431\u0434\u0430\u2011\u0441\u0442\u0438\u043b\u0435 \u0441\u043e \u0441\u0442\u0440\u0435\u043b\u043a\u043e\u0439 \u043c\u0435\u0436\u0434\u0443 \u043c\u0435\u0442\u043a\u043e\u0439 \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0449\u0435\u0439\u0441\u044f \u0447\u0430\u0441\u0442\u044c\u044e. \u042d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u043d\u044b\u0439 \u0435\u043c\u0443 \u043a\u043e\u0434 \u0431\u0435\u0437\u00a0\u043b\u044f\u043c\u0431\u0434\u0430\u2011\u0441\u0442\u0438\u043b\u044f \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0442\u0430\u043a: <\/p>\n<pre><code class=\"java\">boolean result = switch (ternaryBool) {     case TRUE:         yield true;     case FALSE:         yield false;     case FILE_NOT_FOUND:         throw new UncheckedIOException(             \"This is ridiculous!\",             new FileNotFoundException());     default:         throw new IllegalArgumentException(\"Seriously?!\"); }<\/code><\/pre>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e\u00a0\u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u043e\u0432\u043e\u0435 \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e <em>yield<\/em>, \u0447\u0442\u043e\u0431\u044b \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438\u0437\u00a0\u0432\u0435\u0442\u043a\u0438 case (\u044d\u0442\u043e\u0442 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u0432\u00a0Java 13. \u0412\u00a0Java 12\u00a0\u0432\u043c\u0435\u0441\u0442\u043e <em>yield<\/em> \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u043b\u0441\u044f <em>break<\/em>, \u0442.\u00a0\u0435. <em>break true<\/em> \u0432\u043c\u0435\u0441\u0442\u043e <em>yield true, <\/em>\u0447\u0442\u043e\u00a0\u0432\u044b\u0433\u043b\u044f\u0434\u0435\u043b\u043e \u0441\u0442\u0440\u0430\u043d\u043d\u043e).<\/p>\n<p>\u0418\u0441\u0442\u043e\u0440\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u043b\u043e\u0436\u0438\u043b\u043e\u0441\u044c, \u0447\u0442\u043e\u00a0\u043c\u0435\u0442\u043a\u0438 \u0441\u00a0\u0434\u0432\u043e\u0435\u0442\u043e\u0447\u0438\u0435\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0442 \u0442\u043e\u0447\u043a\u0443 \u0432\u0445\u043e\u0434\u0430 \u0432\u00a0\u0431\u043b\u043e\u043a \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432. \u0421\u00a0\u044d\u0442\u043e\u0433\u043e \u043c\u0435\u0441\u0442\u0430 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0433\u043e \u043a\u043e\u0434\u0430 \u043d\u0438\u0436\u0435, \u0434\u0430\u0436\u0435 \u043a\u043e\u0433\u0434\u0430 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u0434\u0440\u0443\u0433\u0430\u044f \u043c\u0435\u0442\u043a\u0430 (\u043f\u0440\u0438 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0438 <em>break<\/em>). \u041c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0442\u0430\u043a\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0438\u0437\u0432\u0435\u0441\u0442\u0435\u043d, \u043a\u0430\u043a\u00a0\u0441\u043a\u0432\u043e\u0437\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u0445\u043e\u0434 \u043a\u00a0\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443 <em>case<\/em>. \u0414\u043b\u044f\u00a0\u0435\u0433\u043e \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f \u043d\u0443\u0436\u0435\u043d <em>break <\/em>\u0438\u043b\u0438 <em>return<\/em>.<\/p>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u00a0\u0436\u0435 \u0441\u0442\u0440\u0435\u043b\u043a\u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0431\u043b\u043e\u043a \u0441\u043f\u0440\u0430\u0432\u0430 \u043e\u0442\u00a0\u043d\u0435\u0435. \u0418 \u043d\u0438\u043a\u0430\u043a\u043e\u0433\u043e \u00ab\u043f\u0440\u043e\u0432\u0430\u043b\u0438\u0432\u0430\u043d\u0438\u044f\u00bb.<\/p>\n<h3>\u041d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u0435\u0442\u043e\u043a \u043d\u0430\u00a0case  <\/h3>\n<p>\u041e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 <em>break<\/em> \u0432 <em>case<\/em> \u0447\u0430\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f\u00a0\u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043a\u00a0\u0432\u0435\u0442\u043a\u0430\u043c \u0441\u00a0\u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u043c\u0435\u0442\u043a\u0430\u043c\u0438<em>. <\/em>\u041f\u0440\u0438\u00a0\u044d\u0442\u043e\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442\u044c \u043a\u00a0\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443 <em>case<\/em>, \u043f\u043e\u043a\u0430 \u043d\u0435\u00a0\u043d\u0430\u0442\u043a\u043d\u0435\u0442\u0441\u044f \u043d\u0430 <em>break. <\/em>\u0418\u0437\u00a0\u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u044b\u0432\u043e\u0434, \u0447\u0442\u043e\u00a0\u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 <em>switch <\/em>\u0432\u00a0\u043a\u0430\u0436\u0434\u043e\u043c <em>case <\/em>\u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u043e\u0439 \u043c\u0435\u0442\u043a\u0438:<\/p>\n<pre><code class=\"java\">switch (number) {     case 1:     case 2:         callMethod(\"few\");         break;     default:         callMethod(\"many\");         break; }<\/code><\/pre>\n<p>\u0410\u00a0\u0432 \u043d\u043e\u0432\u043e\u043c <em>switch <\/em>\u043e\u0434\u0438\u043d <em>case <\/em>\u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c \u043c\u0435\u0442\u043a\u0430\u043c:<\/p>\n<pre><code class=\"java\">String result = switch(ternaryBool) {     case TRUE, FALSE -> \"sane\";     default -> \"insane\"; }<\/code><\/pre>\n<p>\u041f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u044d\u0442\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e: <em>TRUE <\/em>\u0438 <em>FALSE <\/em>\u043f\u0440\u0438\u0432\u043e\u0434\u044f\u0442 \u043a\u00a0\u043e\u0434\u043d\u043e\u043c\u0443 \u0438 \u0442\u043e\u043c\u0443\u00a0\u0436\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0443\u00a0\u2014 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u00absane\u00bb.<\/p>\n<h3>\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e\u00a0\u0441\u0442\u0440\u0435\u043b\u043a\u0435<\/h3>\n<p>\u041d\u0430\u0447\u0438\u043d\u0430\u044f \u0441\u00a0Java 14, <em>switch <\/em>\u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043b\u044f\u043c\u0431\u0434\u0430\u2011\u0441\u0442\u0440\u0435\u043b\u043a\u0443 \u0434\u043b\u044f \u00ab\u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f\u00bb <em>case <\/em>\u0441\u00a0\u043a\u043e\u0434\u043e\u043c:<\/p>\n<pre><code class=\"java\">switch (number) {     case 1 -> callMethod(\"one\");     case 2 -> callMethod(\"two\");     default -> callMethod(\"many\"); }<\/code><\/pre>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0434\u0432\u0430 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430, \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u043d\u044b\u0445 \u0434\u043b\u044f\u00a0\u0441\u0442\u0440\u0435\u043b\u043e\u0447\u043d\u043e\u0439 \u0444\u043e\u0440\u043c\u044b \u0437\u0430\u043f\u0438\u0441\u0438 \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044f:<\/p>\n<ul>\n<li>\n<p> \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u0441\u043a\u0432\u043e\u0437\u043d\u043e\u0433\u043e \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0430 \u043a\u00a0\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443 <em>case<\/em><\/p>\n<\/li>\n<li>\n<p> \u0431\u043b\u043e\u043a\u0438 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432<\/p>\n<\/li>\n<\/ul>\n<h3>\u041e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0430 \u043a\u00a0\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443 case<\/h3>\n<p>\u0412\u043e\u0442, \u0447\u0442\u043e\u00a0\u0433\u043e\u0432\u043e\u0440\u0438\u0442\u0441\u044f \u0432 <a href=\"https:\/\/openjdk.org\/jeps\/325\" rel=\"noopener noreferrer nofollow\">JEP 325<\/a> \u043e\u0431\u00a0\u044d\u0442\u043e\u043c:<\/p>\n<blockquote>\n<p><em>\u0422\u0435\u043a\u0443\u0449\u0438\u0439 \u0434\u0438\u0437\u0430\u0439\u043d \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 switch \u0432\u00a0Java \u0442\u0435\u0441\u043d\u043e \u0441\u0432\u044f\u0437\u0430\u043d \u0441\u00a0\u0442\u0430\u043a\u0438\u043c\u0438 \u044f\u0437\u044b\u043a\u0430\u043c\u0438, \u043a\u0430\u043a\u00a0C \u0438 C++ \u0438 \u043f\u043e\u00a0\u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0441\u043a\u0432\u043e\u0437\u043d\u0443\u044e \u0441\u0435\u043c\u0430\u043d\u0442\u0438\u043a\u0443. \u0425\u043e\u0442\u044f \u044d\u0442\u043e\u0442 \u0442\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0447\u0430\u0441\u0442\u043e \u043f\u043e\u043b\u0435\u0437\u0435\u043d \u0434\u043b\u044f\u00a0\u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043d\u0438\u0437\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u043e\u0433\u043e \u043a\u043e\u0434\u0430 (\u0442\u0430\u043a\u043e\u0433\u043e \u043a\u0430\u043a\u00a0\u043f\u0430\u0440\u0441\u0435\u0440\u044b \u0434\u043b\u044f\u00a0\u0434\u0432\u043e\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f), \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 switch \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432\u00a0\u043a\u043e\u0434\u0435 \u0431\u043e\u043b\u0435\u0435 \u0432\u044b\u0441\u043e\u043a\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f, \u043e\u0448\u0438\u0431\u043a\u0438 \u0442\u0430\u043a\u043e\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0442 \u043f\u0435\u0440\u0435\u0432\u0435\u0448\u0438\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0433\u0438\u0431\u043a\u043e\u0441\u0442\u044c.<\/em><\/p>\n<\/blockquote>\n<p>\u042f \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0441\u043e\u0433\u043b\u0430\u0441\u0435\u043d \u0438 \u043f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <em>switch <\/em>\u0431\u0435\u0437\u00a0\u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043f\u043e\u00a0\u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e:<\/p>\n<pre><code class=\"java\">switch(ternaryBool) {     case TRUE, FALSE -> System.out.println(\"Bool was sane\");     default -> System.out.println(\"Bool was insane\"); }<\/code><\/pre>\n<p>\u0421\u0442\u0440\u0435\u043b\u043a\u0430 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u044b\u0432\u0435\u0441\u0442\u0438 <em>\u00abBool was sane\u00bb<\/em> \u0432\u00a0\u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u043c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0435, \u0432\u00a0\u0442\u043e \u0432\u0440\u0435\u043c\u044f, \u043a\u0430\u043a\u00a0\u0441\u00a0\u0434\u0432\u043e\u0435\u0442\u043e\u0447\u0438\u0435\u043c \u044d\u0442\u043e\u00a0\u0436\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043e\u0442\u043e\u0431\u0440\u0430\u0437\u0438\u043b\u043e\u0441\u044c\u00a0\u0431\u044b \u0434\u0432\u0430\u0436\u0434\u044b.<\/p>\n<h3>\u0411\u043b\u043e\u043a\u0438 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432<\/h3>\n<p>\u041a\u0430\u043a\u00a0\u0438 \u0432\u00a0\u0441\u043b\u0443\u0447\u0430\u0435 \u0441\u00a0\u043b\u044f\u043c\u0431\u0434\u0430\u043c\u0438, \u0441\u0442\u0440\u0435\u043b\u043a\u0430 \u043c\u043e\u0436\u0435\u0442 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c\u00a0\u043b\u0438\u0431\u043e \u043d\u0430\u00a0\u043e\u0434\u0438\u043d \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 (\u043a\u0430\u043a \u0432\u044b\u0448\u0435),\u00a0\u043b\u0438\u0431\u043e \u043d\u0430\u00a0\u0431\u043b\u043e\u043a, \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u0444\u0438\u0433\u0443\u0440\u043d\u044b\u043c\u0438 \u0441\u043a\u043e\u0431\u043a\u0430\u043c\u0438:<\/p>\n<pre><code class=\"java\">boolean result = switch (Bool.random()) {     case TRUE -> {         System.out.println(\"Bool true\");         yield true;     }     case FALSE -> {         System.out.println(\"Bool false\");         yield false;     }     case FILE_NOT_FOUND -> {         var ex = new UncheckedIOException(             \"This is ridiculous!\",             new FileNotFoundException());             throw ex;     }     default -> {         var ex = new IllegalArgumentException(             \"Seriously?!\");             throw ex;     } }<\/code><\/pre>\n<p>\u0411\u043b\u043e\u043a\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b \u0434\u043b\u044f\u00a0\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0431\u043e\u043b\u0435\u0435 \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 \u043a\u043e\u0434\u0430 \u0432 <em>case<\/em>. \u041f\u0440\u0438\u00a0\u044d\u0442\u043e\u043c \u043e\u043d\u0438 \u0438\u043c\u0435\u044e\u0442 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u00a0\u2014 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0435 \u0438\u043c\u0435\u043d\u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0432\u00a0\u0440\u0430\u0437\u043d\u044b\u0445 \u0432\u0435\u0442\u043a\u0430\u0445 \u0437\u0430\u00a0\u0441\u0447\u0435\u0442 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0434\u043b\u044f\u00a0\u043a\u0430\u0436\u0434\u043e\u0439 \u0432\u0435\u0442\u043a\u0438.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0441\u044f \u043d\u0435\u043e\u0431\u044b\u0447\u043d\u044b\u043c \u0441\u043f\u043e\u0441\u043e\u0431 \u0432\u044b\u0445\u043e\u0434\u0430 \u0438\u0437\u00a0\u0431\u043b\u043e\u043a\u043e\u0432 \u0441\u00a0\u043f\u043e\u043c\u043e\u0449\u044c\u044e <em>yield<\/em>, \u0430\u00a0\u043d\u0435 <em>return<\/em>, \u0442\u043e \u044d\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e, \u0447\u0442\u043e\u0431\u044b \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u043f\u0443\u0442\u0430\u043d\u0438\u0446\u044b: <em>return <\/em>\u043c\u043e\u0436\u0435\u0442\u00a0\u0431\u044b\u0442\u044c \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0438\u0441\u0442\u043e\u043b\u043a\u043e\u0432\u0430\u043d, \u043a\u0430\u043a\u00a0\u0432\u044b\u0445\u043e\u0434 \u0438\u0437\u00a0\u043c\u0435\u0442\u043e\u0434\u0430. \u041c\u044b\u00a0\u043b\u0438\u0448\u044c \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u0443 <em>switch<\/em>, \u043e\u0441\u0442\u0430\u0432\u0430\u044f\u0441\u044c \u0432\u00a0\u0442\u043e\u043c\u00a0\u0436\u0435 \u043c\u0435\u0442\u043e\u0434\u0435.<\/p>\n<h3>\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e\u00a0\u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u0445 switch<\/h3>\n<p>\u0418 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435, \u043d\u043e\u00a0\u043d\u0435\u00a0\u043c\u0435\u043d\u0435\u0435 \u0432\u0430\u0436\u043d\u043e\u0435\u00a0\u2014 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f <em>switch <\/em>\u0432\u00a0\u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f:<\/p>\n<ul>\n<li>\n<p>\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f<\/p>\n<\/li>\n<li>\n<p>\u0440\u0430\u043d\u043d\u0438\u0439 \u0432\u043e\u0437\u0432\u0440\u0430\u0442<\/p>\n<\/li>\n<li>\n<p>\u043e\u0445\u0432\u0430\u0442 \u0432\u0441\u0435\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 (\u0438\u0441\u0447\u0435\u0440\u043f\u044b\u0432\u0430\u0435\u043c\u043e\u0441\u0442\u044c)<\/p>\n<\/li>\n<\/ul>\n<h3>\u041c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f<\/h3>\n<p>Switch\u2011\u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c\u0438 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u043c\u0438. \u042d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e\u00a0\u043e\u043d\u0438 \u043d\u0435\u00a0\u0438\u043c\u0435\u044e\u0442 \u0441\u0432\u043e\u0435\u0433\u043e \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430, \u043d\u043e\u00a0\u043c\u043e\u0433\u0443\u0442\u00a0\u0431\u044b\u0442\u044c \u043e\u0434\u043d\u0438\u043c \u0438\u0437\u00a0\u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0442\u0438\u043f\u043e\u0432. \u041d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0447\u0430\u0441\u0442\u043e \u0432\u00a0\u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0442\u0430\u043a\u0438\u0445 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u043b\u044f\u043c\u0431\u0434\u0430\u2011\u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f: <em>s \u2192 s + \u00bb \u00ab<\/em>, \u043c\u043e\u0433\u0443\u0442\u00a0\u0431\u044b\u0442\u044c \u0438 <em>Function&lt;String, String><\/em>, \u0438 <em>Function&lt;Serializable, \u0438 Object><\/em> \u0438\u043b\u0438 <em>UnaryOperator&lt;String><\/em>.<\/p>\n<p>\u0422\u0438\u043f switch\u2011\u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u0441\u0445\u043e\u0434\u044f \u0438\u0437\u00a0\u0442\u0438\u043f\u043e\u0432 \u0435\u0433\u043e \u0432\u0435\u0442\u043e\u043a, \u0430\u00a0\u0442\u0430\u043a\u0436\u0435 \u0438\u0437\u00a0\u043c\u0435\u0441\u0442\u0430 \u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f. \u0415\u0441\u043b\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0440\u0430\u0431\u043e\u0442\u044b switch\u2011\u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0442\u0438\u043f\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439, \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u0432\u00a0\u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 \u0438\u043b\u0438\u00a0\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432\u00a0\u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435, \u0433\u0434\u0435 \u0438\u0437\u0432\u0435\u0441\u0442\u0435\u043d \u0442\u043e\u0447\u043d\u044b\u0439 \u0442\u0438\u043f (\u0446\u0435\u043b\u0435\u0432\u043e\u0439 \u0442\u0438\u043f), \u0442\u043e \u0432\u0441\u0435 \u0435\u0433\u043e \u0432\u0435\u0442\u043a\u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u043c\u0443 \u0442\u0438\u043f\u0443. \u0412\u043e\u0442, \u0447\u0442\u043e\u00a0\u043c\u044b \u0434\u0435\u043b\u0430\u043b\u0438 \u0434\u043e\u00a0\u0441\u0438\u0445 \u043f\u043e\u0440:<\/p>\n<pre><code class=\"java\">String result = switch (ternaryBool) {     case TRUE, FALSE -> \"sane\";     default -> \"insane\"; }<\/code><\/pre>\n<p>\u041a\u0430\u043a\u00a0\u0438\u0442\u043e\u0433\u00a0\u2014 <em>switch <\/em>\u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 <em>String result<\/em>. \u0421\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e, <em>String <\/em>\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0446\u0435\u043b\u0435\u0432\u044b\u043c \u0442\u0438\u043f\u043e\u043c, \u0438 \u0432\u0441\u0435 \u0432\u0435\u0442\u043a\u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u044d\u0442\u043e\u0433\u043e \u0442\u0438\u043f\u0430.<\/p>\n<p>\u0422\u043e\u00a0\u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0438 \u0437\u0434\u0435\u0441\u044c:<\/p>\n<pre><code class=\"java\">Serializable serializableMessage = switch (bool) {     case TRUE, FALSE -> \"sane\";     \/\/ note that we don't throw the exception!     \/\/ but it's `Serializable`, so it matches the target type     default -> new IllegalArgumentException(\"insane\"); }<\/code><\/pre>\n<p> \u0410\u00a0\u0447\u0442\u043e\u00a0\u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0435\u0442 \u0441\u0435\u0439\u0447\u0430\u0441?<\/p>\n<pre><code class=\"java\">\/\/ compiler infers super type of `String` and \/\/ `IllegalArgumentException` ~> `Serializable` var serializableMessage = switch (bool) {     case TRUE, FALSE -> \"sane\";     \/\/ note that we don't throw the exception!     default -> new IllegalArgumentException(\"insane\"); }<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u0446\u0435\u043b\u0435\u0432\u043e\u0439 \u0442\u0438\u043f \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u0435\u043d \u0438\u0437\u2011\u0437\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f <em>var<\/em>, \u0442\u043e \u043e\u043d \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0443\u0442\u0435\u043c \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u0441\u0443\u043f\u0435\u0440\u0442\u0438\u043f\u0430 \u0438\u0437\u00a0\u0442\u0438\u043f\u043e\u0432, \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0445 \u0432\u0435\u0442\u043a\u0430\u043c\u0438.<\/p>\n<h3>\u0420\u0430\u043d\u043d\u0438\u0439 \u0432\u043e\u0437\u0432\u0440\u0430\u0442<\/h3>\n<p>\u0421\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0435\u043c \u0440\u0430\u0437\u043b\u0438\u0447\u0438\u044f \u043c\u0435\u0436\u0434\u0443 <em>\u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435\u043c<\/em> \u0438 <em>\u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u043c<\/em> <em>switch <\/em>\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u043e, \u0447\u0442\u043e\u00a0\u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <em>return <\/em>\u0434\u043b\u044f\u00a0\u0432\u044b\u0445\u043e\u0434\u0430 \u0438\u0437\u00a0\u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 <em>switch:<\/em><\/p>\n<pre><code class=\"java\">public String sanity(Bool ternaryBool) {     switch (ternaryBool) {         \/\/ `return` is only possible from block         case TRUE, FALSE -> { return \"sane\"; }         default -> { return \"This is ridiculous!\"; }     }; }<\/code><\/pre>\n<p> \u0410\u00a0\u0432\u043e\u0442 \u0432\u043d\u0443\u0442\u0440\u0438 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <em>return<\/em> \u0443\u0436\u0435 \u043d\u0435\u00a0\u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f:<\/p>\n<pre><code class=\"java\">public String sanity(Bool ternaryBool) {     String result = switch (ternaryBool) {         \/\/ this does not compile - error:         \/\/ \"return outside of enclosing switch expression\"         case TRUE, FALSE -> { return \"sane\"; }         default -> { return \"This is ridiculous!\"; }     }; }<\/code><\/pre>\n<p>\u042d\u0442\u043e \u0438\u043c\u0435\u0435\u0442 \u0441\u043c\u044b\u0441\u043b \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e \u043e\u0442\u00a0\u0442\u043e\u0433\u043e, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435\u00a0\u043b\u0438 \u0432\u044b \u0441\u0442\u0440\u0435\u043b\u043a\u0443 \u0438\u043b\u0438\u00a0\u0434\u0432\u043e\u0435\u0442\u043e\u0447\u0438\u0435.<\/p>\n<h3>\u041e\u0445\u0432\u0430\u0442 \u0432\u0441\u0435\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 (\u0438\u0441\u0447\u0435\u0440\u043f\u044b\u0432\u0430\u0435\u043c\u043e\u0441\u0442\u044c)<\/h3>\n<p><strong>\u0415\u0441\u043b\u0438 \u0432\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 <em>switch <\/em>\u0432\u00a0\u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430, \u0442\u043e\u0433\u0434\u0430 \u043d\u0435\u00a0\u0438\u043c\u0435\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u043e\u0445\u0432\u0430\u0447\u0435\u043d\u044b \u0432\u0441\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u0438\u043b\u0438\u00a0\u043d\u0435\u0442.<\/strong> \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c <em>case<\/em>, \u0438 \u043a\u043e\u0434 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e, \u043d\u043e\u00a0\u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0443 \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e\u00a0\u2014 \u0432\u044b, \u0432\u0430\u0448\u0430 IDE \u0438 \u0432\u0430\u0448\u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u043a\u043e\u0434\u0430 \u043e\u0441\u0442\u0430\u043d\u0435\u0442\u0435\u0441\u044c \u0441\u00a0\u044d\u0442\u0438\u043c \u043d\u0430\u0435\u0434\u0438\u043d\u0435.<\/p>\n<p>Switch\u2011\u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0443\u0441\u0443\u0433\u0443\u0431\u043b\u044f\u044e\u0442 \u044d\u0442\u0443 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443. \u041a\u0443\u0434\u0430 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043f\u0435\u0440\u0435\u0439\u0442\u0438 <em>switch<\/em>, \u0435\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u0430\u044f \u043c\u0435\u0442\u043a\u0430 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442? \u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043e\u0442\u0432\u0435\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u0435\u0442 \u0434\u0430\u0442\u044c Java\u00a0\u2014 \u044d\u0442\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c <em>null <\/em>\u0434\u043b\u044f\u00a0\u0441\u0441\u044b\u043b\u043e\u0447\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u00a0\u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0434\u043b\u044f\u00a0\u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043e\u0432. \u042d\u0442\u043e \u043f\u043e\u0440\u043e\u0434\u0438\u043b\u043e\u00a0\u0431\u044b \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043e\u0448\u0438\u0431\u043e\u043a \u0432\u00a0\u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u043a\u043e\u0434\u0435.<\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u043f\u0440\u0435\u0434\u043e\u0442\u0432\u0440\u0430\u0442\u0438\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u0438\u0441\u0445\u043e\u0434, \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043c\u043e\u0447\u044c \u0432\u0430\u043c. <strong>\u0414\u043b\u044f\u00a0switch\u2011\u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0441\u0442\u0430\u0438\u0432\u0430\u0442\u044c, \u0447\u0442\u043e\u0431\u044b \u0432\u0441\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b\u00a0\u0431\u044b\u043b\u0438 \u043e\u0445\u0432\u0430\u0447\u0435\u043d\u044b.<\/strong> \u0414\u043b\u044f\u00a0\u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 <em>switch <\/em>\u0434\u043e\u043b\u0436\u043d\u0430\u00a0\u0431\u044b\u0442\u044c \u0432\u0435\u0442\u0432\u044c\u00a0\u2014 \u044d\u0442\u043e \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0438\u0441\u0447\u0435\u0440\u043f\u044b\u0432\u0430\u0435\u043c\u043e\u0441\u0442\u044c\u044e. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430\u00a0\u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a\u00a0\u043e\u0448\u0438\u0431\u043a\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438:<\/p>\n<pre><code class=\"java\">\/\/ compile error: \/\/ \"the switch expression does not cover all possible input values\" boolean result = switch (ternaryBool) {     case TRUE -> true;     \/\/ no case for `FALSE`     case FILE_NOT_FOUND -> throw new UncheckedIOException(         \"This is ridiculous!\",         new FileNotFoundException()); }<\/code><\/pre>\n<p>\u0418\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435: \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0432\u0435\u0442\u043a\u0438 <em>default<\/em>, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442 \u043e\u0448\u0438\u0431\u043a\u0443, \u043d\u043e\u00a0\u044d\u0442\u043e \u043d\u0435\u00a0\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c\u00a0\u2014 \u0435\u0449\u0435 \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c <em>case <\/em>\u0434\u043b\u044f <em>FALSE<\/em>.<\/p>\n<pre><code class=\"java\">\/\/ compiles without `default` branch because \/\/ all cases for `ternaryBool` are covered boolean result = switch (ternaryBool) {     case TRUE -> true;     case FALSE -> false;     case FILE_NOT_FOUND -> throw new UncheckedIOException(         \"This is ridiculous!\",         new FileNotFoundException()); }<\/code><\/pre>\n<p>\u0414\u0430, \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u043d\u0430\u043a\u043e\u043d\u0435\u0446\u2011\u0442\u043e \u0441\u043c\u043e\u0436\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c, \u043e\u0445\u0432\u0430\u0442\u044b\u0432\u0430\u044e\u0442\u0441\u044f\u00a0\u043b\u0438 \u0432\u0441\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f <em>enum<\/em>, \u0447\u0442\u043e\u00a0\u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0435\u00a0\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u0435\u0441\u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 <em>default!<\/em><\/p>\n<p>\u0427\u0442\u043e\u00a0\u043a\u0430\u0441\u0430\u0435\u0442\u0441\u044f \u0438\u0441\u0447\u0435\u0440\u043f\u044b\u0432\u0430\u0435\u043c\u043e\u0441\u0442\u0438, \u044f \u0441\u0442\u0430\u0440\u0430\u044e\u0441\u044c \u0438\u0437\u0431\u0435\u0433\u0430\u0442\u044c \u0432\u0435\u0442\u0432\u0435\u0439 \u043f\u043e\u00a0\u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, \u043a\u043e\u0433\u0434\u0430 \u044d\u0442\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0438\u0442\u0430\u044f \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438, \u043a\u043e\u0433\u0434\u0430 \u0447\u0442\u043e\u2011\u0442\u043e \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f.<\/p>\n<p>\u0425\u043e\u0442\u044f, \u044d\u0442\u043e \u0432\u0441\u0435\u00a0\u0436\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u043e\u0434\u0438\u043d \u0432\u043e\u043f\u0440\u043e\u0441. \u0427\u0442\u043e\u00a0\u0434\u0435\u043b\u0430\u0442\u044c, \u0435\u0441\u043b\u0438 \u043a\u0442\u043e\u2011\u0442\u043e \u0432\u043e\u0437\u044c\u043c\u0435\u0442 \u0438 \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u0442 \u0441\u0443\u043c\u0430\u0441\u0448\u0435\u0434\u0448\u0438\u0439 <em>Bool <\/em>\u0432\u00a0\u043a\u0432\u0430\u0442\u0435\u0440\u043d\u0438\u043e\u043d\u043d\u044b\u0439 (\u0441 \u0447\u0435\u0442\u044b\u0440\u044c\u043c\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438) <em>Boolean<\/em>, \u0434\u043e\u0431\u0430\u0432\u0438\u0432 \u0447\u0435\u0442\u0432\u0435\u0440\u0442\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435? \u0415\u0441\u043b\u0438 \u0432\u044b \u043f\u0435\u0440\u0435\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u0442\u0435 switch\u2011\u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f\u00a0\u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u043e\u0433\u043e <em>Bool<\/em>, \u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0435 \u043e\u0448\u0438\u0431\u043a\u0443 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 (\u0442. \u043a. \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435\u00a0\u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u0447\u0435\u0440\u043f\u044b\u0432\u0430\u044e\u0449\u0438\u043c). \u0427\u0442\u043e\u0431\u044b \u043e\u0442\u043b\u043e\u0432\u0438\u0442\u044c \u044d\u0442\u0443 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443, \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442 \u0432\u00a0\u0432\u0435\u0442\u043a\u0443 <em>default<\/em>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u0435\u0434\u0435\u0442 \u0441\u0435\u0431\u044f \u0442\u0430\u043a\u00a0\u0436\u0435, \u043a\u0430\u043a\u00a0\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u0434\u043e\u00a0\u0441\u0438\u0445 \u043f\u043e\u0440, \u0432\u044b\u0437\u044b\u0432\u0430\u044f \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435.<\/p>\n<p>\u0412\u00a0\u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u043e\u0445\u0432\u0430\u0442 \u0432\u0441\u0435\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0431\u0435\u0437\u00a0\u0432\u0435\u0442\u043a\u0438 <em>default <\/em>\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f <em>enum<\/em>, \u043d\u043e\u00a0\u043a\u043e\u0433\u0434\u0430 <em>switch <\/em>\u0432\u00a0\u0431\u0443\u0434\u0443\u0449\u0438\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 Java \u0441\u0442\u0430\u043d\u0435\u0442 \u0431\u043e\u043b\u0435\u0435 \u043c\u043e\u0449\u043d\u044b\u043c, \u043e\u043d \u0442\u0430\u043a\u0436\u0435 \u0441\u043c\u043e\u0436\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0438 \u0441\u00a0\u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u044b\u043c\u0438 \u0442\u0438\u043f\u0430\u043c\u0438. \u0415\u0441\u043b\u0438 \u043c\u0435\u0442\u043a\u0438 <em>case<\/em>  \u0441\u043c\u043e\u0433\u0443\u0442 \u043d\u0435\u00a0\u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u0440\u0430\u0432\u0435\u043d\u0441\u0442\u0432\u043e, \u043d\u043e\u00a0\u0438 \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u0442\u044c \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 _ &lt; 5\u00a0\u2192 \u2026)\u00a0\u2014 \u044d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u043e\u0445\u0432\u0430\u0442\u0438\u0442\u044c \u0432\u0441\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u0434\u043b\u044f\u00a0\u0447\u0438\u0441\u043b\u043e\u0432\u044b\u0445 \u0442\u0438\u043f\u043e\u0432.<\/p>\n<h3>\u041a\u0430\u043a \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f switch \u0432 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 Java<\/h3>\n<p>\u0414\u043e\u00a0\u044d\u0442\u043e\u0433\u043e \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u043b\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u0438 \u0434\u043e\u00a0Java 14. \u0422\u0435\u043f\u0435\u0440\u044c \u043e\u0431\u0441\u0443\u0434\u0438\u043c \u0442\u043e, \u0447\u0442\u043e\u00a0\u0431\u044b\u043b\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043e \u043f\u043e\u0441\u043b\u0435.<\/p>\n<h3>\u041f\u0430\u0442\u0442\u0435\u0440\u043d\u044b (\u0448\u0430\u0431\u043b\u043e\u043d\u044b)<\/h3>\n<p>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f <a href=\"https:\/\/nipafx.dev\/java-pattern-matching\/\" rel=\"noopener noreferrer nofollow\"><em>\u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u00a0\u043e\u0431\u0440\u0430\u0437\u0446\u043e\u043c<\/em><\/a> \u0432 <em>switch <\/em>\u0432\u0441\u0435 \u0435\u0449\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432\u00a0\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438, \u043d\u043e\u00a0\u0435\u0441\u0442\u044c \u0442\u0440\u0438 \u0430\u0441\u043f\u0435\u043a\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b \u043f\u043e\u00a0\u0434\u0430\u043d\u043d\u043e\u0439 \u0442\u0435\u043c\u0435.<\/p>\n<h3>\u041f\u0430\u0442\u0442\u0435\u0440\u043d\u044b \u0442\u0438\u043f\u043e\u0432<\/h3>\n<p>\u041d\u0430\u00a0\u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0441\u0442\u0430\u0442\u044c\u0438 Java \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e <a href=\"https:\/\/nipafx.dev\/java-type-pattern-matching\/\" rel=\"noopener noreferrer nofollow\">\u043f\u0430\u0442\u0442\u0435\u0440\u043d\u044b \u0442\u0438\u043f\u043e\u0432<\/a> (Type Patterns) \u0441\u00a0\u043f\u0430\u0442\u0442\u0435\u0440\u043d\u0430\u043c\u0438 \u0434\u0435\u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u0434\u043b\u044f\u00a0\u0437\u0430\u043f\u0438\u0441\u0435\u0439 (records), \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u043c\u0438 <a href=\"https:\/\/openjdk.java.net\/jeps\/405\" rel=\"noopener noreferrer nofollow\">JEP 405<\/a>. \u0418\u0445 \u0443\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u00a0\u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430\u0445<em> if \u0438<\/em> <em>switch<\/em>:<\/p>\n<pre><code class=\"java\">Object obj = \/\/ ...  \/\/ \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 Java 16 if (obj instanceof String str)     callStringMethod(str); else if (obj instanceof Number no)     callNumberMethod(no); else     callObjectMethod(obj);  \/\/ \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 (\u043a\u0430\u043a \u043f\u0440\u0435\u0432\u044c\u044e) \u0441 JDK 17+ switch (obj) {     case String str -> callStringMethod(str);     case Number no -> callNumberMethod(no);     default -> callObjectMethod(obj); }<\/code><\/pre>\n<p>\u042f \u0434\u0443\u043c\u0430\u044e, \u0447\u0442\u043e\u00a0\u0441\u00a0\u0442\u0430\u043a\u0438\u043c\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u043c\u0438 <em>switch<\/em> \u0441\u0442\u0430\u043d\u0435\u0442 \u0431\u043e\u043b\u0435\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u043c \u0438 \u0438\u043d\u0442\u0443\u0438\u0442\u0438\u0432\u043d\u044b\u043c \u0437\u0430\u00a0\u0441\u0447\u0435\u0442 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e:<\/p>\n<ul>\n<li>\n<p>\u0431\u043e\u043b\u0435\u0435 \u0447\u0435\u0442\u043a\u043e \u0432\u044b\u0440\u0430\u0436\u0430\u0435\u0442 \u043d\u0430\u043c\u0435\u0440\u0435\u043d\u0438\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0440\u043e\u0432\u043d\u043e \u043e\u0434\u043d\u0443 \u0432\u0435\u0442\u0432\u044c \u043d\u0430\u00a0\u043e\u0441\u043d\u043e\u0432\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432 <em>obj<\/em><\/p>\n<\/li>\n<li>\n<p>\u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0438\u0441\u0447\u0435\u0440\u043f\u044b\u0432\u0430\u0435\u043c\u043e\u0441\u0442\u044c<\/p>\n<\/li>\n<li>\n<p>\u0435\u0441\u043b\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 <em>switch <\/em>\u0432\u00a0\u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0431\u043e\u043b\u0435\u0435 \u043a\u0440\u0430\u0442\u043a\u0438\u043c<\/p>\n<\/li>\n<\/ul>\n<h3>\u041f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0443\u0442\u043e\u0447\u043d\u0435\u043d\u0438\u0439 (Clauses)<\/h3>\n<p>\u0423\u0442\u043e\u0447\u043d\u0435\u043d\u0438\u044f (<a href=\"https:\/\/openjdk.java.net\/jeps\/420\" rel=\"noopener noreferrer nofollow\">\u0440\u0430\u043d\u0435\u0435<\/a> \u00a0\u2014 guarded patterns) \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u044e\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u0430 \u0441\u00a0\u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a. \u042d\u0442\u043e \u043c\u043e\u0436\u0435\u0442\u00a0\u0431\u044b\u0442\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c (\u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441, \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u043d\u043d\u044b\u0439 \u043c\u043d\u043e\u0439):<\/p>\n<pre><code class=\"java\">String str = \/\/ ... String length = switch (str) {     case str.length() > 42 -> \"long\";     case str.length() > 19 -> \"medium\";     case str.length() > 1 -> \"small\";     case null || str.length() == 0 -> \"empty\"; }<\/code><\/pre>\n<p>\u041f\u043e\u00a0\u043c\u0435\u0440\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a <em>switch <\/em>\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0432\u0441\u0435 \u0431\u043e\u043b\u0435\u0435 \u043c\u043e\u0449\u043d\u044b\u043c, \u044f \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u044e, \u0447\u0442\u043e\u00a0\u043e\u043d \u043d\u0430\u0447\u043d\u0435\u0442 \u043f\u043e\u0433\u043b\u043e\u0449\u0430\u0442\u044c \u0447\u0430\u0441\u0442\u0438 \u043a\u043e\u0434\u0430, \u0434\u043b\u044f\u00a0\u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f <em>if\u2011else\u2011if<\/em>.<\/p>\n<h3>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h3>\n<p>\u0418\u0437\u00a0\u0441\u0442\u0430\u0442\u044c\u0438 \u043c\u044b \u0443\u0437\u043d\u0430\u043b\u0438, \u0447\u0442\u043e\u00a0Java \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u0442 <em>switch <\/em>\u0432\u00a0\u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435, \u043d\u0430\u0434\u0435\u043b\u044f\u044f \u0435\u0433\u043e \u043d\u043e\u0432\u044b\u043c\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u043c\u0438:<\/p>\n<ul>\n<li>\n<p>\u0442\u0435\u043f\u0435\u0440\u044c \u043e\u0434\u0438\u043d <em>case <\/em>\u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c \u043c\u0435\u0442\u043a\u0430\u043c<\/p>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p>\u043d\u043e\u0432\u0430\u044f \u0441\u0442\u0440\u0435\u043b\u043e\u0447\u043d\u0430\u044f \u0444\u043e\u0440\u043c\u0430 <em>case \u2026 \u2192 \u2026 <\/em>\u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0443 \u043b\u044f\u043c\u0431\u0434\u0430\u2011\u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0439:<\/p>\n<ul>\n<li>\n<p>\u0434\u043e\u043f\u0443\u0441\u043a\u0430\u044e\u0442\u0441\u044f \u043e\u0434\u043d\u043e\u0441\u0442\u0440\u043e\u0447\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u044b \u0438\u043b\u0438\u00a0\u0431\u043b\u043e\u043a\u0438<\/p>\n<\/li>\n<li>\n<p>\u043f\u0440\u0435\u0434\u043e\u0442\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0441\u043a\u0432\u043e\u0437\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u0445\u043e\u0434 \u043a\u00a0\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443 <em>case<\/em><\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p>\u0442\u0435\u043f\u0435\u0440\u044c \u0432\u0441\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043e\u0446\u0435\u043d\u0438\u0432\u0430\u0435\u0442\u0441\u044f, \u043a\u0430\u043a\u00a0\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0437\u0430\u0442\u0435\u043c \u043c\u043e\u0436\u0435\u0442\u00a0\u0431\u044b\u0442\u044c \u043f\u0440\u0438\u0441\u0432\u043e\u0435\u043d\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0438\u043b\u0438\u00a0\u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043e, \u043a\u0430\u043a\u00a0\u0447\u0430\u0441\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u043a\u0440\u0443\u043f\u043d\u043e\u0433\u043e \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430<\/p>\n<\/li>\n<li>\n<p>\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435: \u0435\u0441\u043b\u0438 \u0446\u0435\u043b\u0435\u0432\u043e\u0439 \u0442\u0438\u043f \u0438\u0437\u0432\u0435\u0441\u0442\u0435\u043d, \u0442\u043e \u0432\u0441\u0435 \u0432\u0435\u0442\u043a\u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u0435\u043c\u0443 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c. \u0412\u00a0\u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u0442\u0438\u043f, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0432\u0441\u0435\u043c \u0432\u0435\u0442\u043a\u0430\u043c<\/p>\n<\/li>\n<li>\n<p><em>yield <\/em>\u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438\u0437\u00a0\u0431\u043b\u043e\u043a\u0430<\/p>\n<\/li>\n<li>\n<p>\u0434\u043b\u044f\u00a0\u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f <em>switch, <\/em>\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0435\u0435 <em>enum<\/em>, \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u043e\u0445\u0432\u0430\u0442 \u0432\u0441\u0435\u0445 \u0435\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439. \u0415\u0441\u043b\u0438 <em>default <\/em>\u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442, \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u0435\u0442\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/p>\n<\/li>\n<li>\n<p>\u0435\u0441\u043b\u0438 \u0448\u0430\u0431\u043b\u043e\u043d\u044b \u0441\u0442\u0430\u043d\u0443\u0442 \u0431\u043e\u043b\u0435\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u043c\u0438, \u0442\u043e \u043e\u043d\u0438 \u0441\u043c\u043e\u0433\u0443\u0442 \u0441\u0434\u0435\u043b\u0430\u0442\u044c <em>switch <\/em>\u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0442\u0438\u0442\u0435\u043b\u044c\u043d\u0435\u0435 <em>if<\/em><\/p>\n<\/li>\n<\/ul>\n<\/div>\n<\/div>\n<\/div>\n<p> <!----> <!----><\/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\/post\/724186\/\"> https:\/\/habr.com\/ru\/post\/724186\/<\/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<h3>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h3>\n<p>\u0421\u0442\u0430\u0440\u044b\u0439 \u0434\u043e\u0431\u0440\u044b\u0439 <em>switch <\/em>\u0431\u044b\u043b \u0432\u00a0Java \u0441\u00a0\u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0434\u043d\u044f. \u041c\u044b \u0432\u0441\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0435\u0433\u043e \u0438 \u043f\u0440\u0438\u0432\u044b\u043a\u043b\u0438 \u043a\u00a0\u043d\u0435\u043c\u0443\u00a0\u2014 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u043a\u00a0\u0435\u0433\u043e \u043f\u0440\u0438\u0447\u0443\u0434\u0430\u043c (\u043a\u043e\u0433\u043e\u2011\u043d\u0438\u0431\u0443\u0434\u044c \u0435\u0449\u0435 \u0440\u0430\u0437\u0434\u0440\u0430\u0436\u0430\u0435\u0442 <em>break<\/em>?). \u041d\u043e\u00a0\u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 <a href=\"https:\/\/openjdk.org\/jeps\/325\" rel=\"noopener noreferrer nofollow\">Java 12<\/a>, \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f: <em>switch <\/em>\u0432\u043c\u0435\u0441\u0442\u043e \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u0441\u0442\u0430\u043b \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435\u043c: <\/p>\n<pre><code class=\"java\">boolean result = switch(ternaryBool) {     case TRUE -> true;     case FALSE -> false;     case FILE_NOT_FOUND -> throw new UncheckedIOException(         \"This is ridiculous!\",         new FileNotFoundException());     default -> throw new IllegalArgumentException(\"Seriously?!\"); }<\/code><\/pre>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0440\u0430\u0431\u043e\u0442\u044b switch\u2011\u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0442\u0435\u043f\u0435\u0440\u044c<em> <\/em>\u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u0432\u00a0\u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e; \u0443\u0448\u043b\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <em>break<\/em> \u0432\u00a0\u043a\u0430\u0436\u0434\u043e\u0439 \u0432\u0435\u0442\u043a\u0435 <em>case <\/em>\u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u043b\u044f\u043c\u0431\u0434\u0430\u2011\u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0443 \u0438 \u043c\u043d\u043e\u0433\u043e\u0435 \u0434\u0440\u0443\u0433\u043e\u0435. <\/p>\n<p>\u041a\u043e\u0433\u0434\u0430 \u0434\u0435\u043b\u043e \u0434\u043e\u0445\u043e\u0434\u0438\u0442 \u0434\u043e <em>switch <\/em>\u043f\u043e\u0441\u043b\u0435 Java 14, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0441\u0442\u0438\u043b\u044c \u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f:<\/p>\n<ul>\n<li>\n<p>\u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 \u0438\u043b\u0438\u00a0\u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 (\u0441 Java 14)<\/p>\n<\/li>\n<li>\n<p>\u0434\u0432\u043e\u0435\u0442\u043e\u0447\u0438\u044f \u0438\u043b\u0438\u00a0\u0441\u0442\u0440\u0435\u043b\u043a\u0438 (\u0441 Java 14)<\/p>\n<\/li>\n<li>\n<p>\u043c\u0435\u0442\u043a\u0438 \u0438\u043b\u0438\u00a0\u0448\u0430\u0431\u043b\u043e\u043d\u044b (3-\u0439 \u043f\u0440\u0435\u0432\u044c\u044e \u0432\u00a0Java 19)<\/p>\n<\/li>\n<\/ul>\n<p>\u0412\u00a0\u044d\u0442\u043e\u043c \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0435 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043e\u0431\u043e\u00a0\u0432\u0441\u0435\u043c, \u0447\u0442\u043e\u00a0\u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0437\u043d\u0430\u0442\u044c \u043e\u00a0switch\u2011\u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u0445, \u0438 \u043a\u0430\u043a\u00a0\u0438\u0445 \u043b\u0443\u0447\u0448\u0435 \u0432\u0441\u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u00a0\u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 Java. <\/p>\n<h3>\u041d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0438 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 switch<\/h3>\n<p>\u041f\u0440\u0435\u0436\u0434\u0435, \u0447\u0435\u043c \u043c\u044b \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043a\u00a0\u043e\u0431\u0437\u043e\u0440\u0443 \u043d\u043e\u0432\u043e\u0432\u0432\u0435\u0434\u0435\u043d\u0438\u0439, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043e\u0434\u0438\u043d \u043f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u0434\u0430. \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u043c\u044b \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0438\u0441\u044c \u0441 \u00ab\u0443\u0436\u0430\u0441\u043d\u044b\u043c\u00bb <a href=\"https:\/\/thedailywtf.com\/articles\/What_Is_Truth_0x3f_\" rel=\"noopener noreferrer nofollow\">\u0442\u0435\u0440\u043d\u0430\u0440\u043d\u044b\u043c boolean<\/a> \u0438 \u0445\u043e\u0442\u0438\u043c \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0432\u00a0\u043e\u0431\u044b\u0447\u043d\u044b\u0439 boolean. \u0412\u043e\u0442 \u043e\u0434\u0438\u043d \u0438\u0437\u00a0\u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e: <\/p>\n<pre><code class=\"java\">boolean result; switch(ternaryBool) {     case TRUE:         result = true;         break;     case FALSE:         result = false;         break;     case FILE_NOT_FOUND:         \/\/ \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0434\u043b\u044f \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0432 default         var ex = new UncheckedIOException(\"This is ridiculous!\",              new FileNotFoundException());         throw ex;     default:         \/\/ \u0410 \u0432\u043e\u0442 \u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430: \u043c\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u043e\u0431\u044a\u044f\u0432\u0438\u0442\u044c \u0435\u0449\u0435 \u043e\u0434\u043d\u0443 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0441 \u0438\u043c\u0435\u043d\u0435\u043c ex         var ex2 = new IllegalArgumentException(\"Seriously?!\");         throw ex2; }<\/code><\/pre>\n<p>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u0445\u0440\u043e\u043c\u0430\u0435\u0442: \u043d\u0430\u043b\u0438\u0447\u0438\u0435 <em>break <\/em>\u0432\u00a0\u043a\u0430\u0436\u0434\u043e\u0439 \u0432\u0435\u0442\u043a\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043b\u0435\u0433\u043a\u043e \u0437\u0430\u0431\u044b\u0442\u044c; \u043c\u043e\u0436\u043d\u043e \u043d\u0435\u00a0\u0443\u0447\u0435\u0441\u0442\u044c \u0432\u0441\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f <em>ternaryBool<\/em> (\u0437\u0430\u0431\u044b\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u043a\u043e\u0439\u2011\u0442\u043e <em>case<\/em>); \u0441\u00a0\u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 <em>result<\/em>  \u043d\u0435\u00a0\u0432\u0441\u0435 \u0433\u043b\u0430\u0434\u043a\u043e\u00a0\u2014 \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043d\u0435\u00a0\u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0435\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044e; \u043d\u0435\u043b\u044c\u0437\u044f \u043e\u0431\u044a\u044f\u0432\u0438\u0442\u044c \u0432\u00a0\u0440\u0430\u0437\u043d\u044b\u0445 \u0432\u0435\u0442\u043a\u0430\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0441\u00a0\u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u043c \u0438\u043c\u0435\u043d\u0435\u043c. \u0421\u043e\u0433\u043b\u0430\u0441\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e\u00a0\u0434\u0430\u043d\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043a\u0440\u0430\u0439\u043d\u0435 \u0433\u0440\u043e\u043c\u043e\u0437\u0434\u043a\u043e \u0438 \u043d\u0435\u0443\u0434\u043e\u0431\u043d\u043e\u00a0\u2014 \u0442\u0443\u0442 \u044f\u0432\u043d\u043e \u0435\u0441\u0442\u044c, \u0447\u0442\u043e\u00a0\u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c.<\/p>\n<p>\u0410\u00a0\u0432\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u043e\u043f\u0440\u043e\u0449\u0435, \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u0443\u044e\u0449\u0438\u0439 \u043f\u043e\u0445\u043e\u0436\u0438\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b:<\/p>\n<pre><code class=\"java\">int result; switch (number) {     case 1:         result = callMethod(\"one\");         break;     case 2:         result = callMethod(\"two\");         break;     default:         result = callMethod(\"many\");         break; }<\/code><\/pre>\n<p> \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0443\u0441\u0442\u0440\u0430\u043d\u0438\u0442\u044c \u0432\u0441\u0435 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0438, \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0432 <em>switch <\/em>\u0432\u00a0\u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434: <\/p>\n<pre><code class=\"java\">private static boolean toBoolean(Bool ternaryBool) {     switch(ternaryBool) {         case TRUE: return true;         case FALSE: return false;         case FILE_NOT_FOUND:             throw new UncheckedIOException(\"This is ridiculous!\",                   new FileNotFoundException());         \/\/ \u0431\u0435\u0437 default \u043c\u0435\u0442\u043e\u0434 \u043d\u0435 \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f         default:             throw new IllegalArgumentException(\"Seriously?!\");       } }<\/code><\/pre>\n<p>\u0422\u0430\u043a \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u043b\u0443\u0447\u0448\u0435: \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0444\u0438\u043a\u0442\u0438\u0432\u043d\u0430\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f <em>result<\/em>, \u043d\u0435\u0442 <em>break<\/em>, \u0437\u0430\u0433\u0440\u043e\u043c\u043e\u0436\u0434\u0430\u044e\u0449\u0438\u0445 \u043a\u043e\u0434 \u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430 \u043e\u0431\u00a0\u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0438 <em>default <\/em>(\u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0432\u00a0\u044d\u0442\u043e\u043c \u043d\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438, \u043a\u0430\u043a\u00a0\u0432\u00a0\u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435). <\/p>\n<p>\u041d\u043e\u00a0\u0435\u0441\u043b\u0438 \u043f\u043e\u0434\u0443\u043c\u0430\u0442\u044c, \u0442\u043e \u043c\u044b \u043d\u0435\u00a0\u043e\u0431\u044f\u0437\u0430\u043d\u044b \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f\u00a0\u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043e\u0431\u043e\u0439\u0442\u0438 \u043d\u0435\u0443\u043a\u043b\u044e\u0436\u0443\u044e \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u044f\u0437\u044b\u043a\u0430. \u0418 \u044d\u0442\u043e \u0434\u0430\u0436\u0435 \u0431\u0435\u0437\u00a0\u0443\u0447\u0451\u0442\u0430, \u0447\u0442\u043e\u00a0\u0442\u0430\u043a\u043e\u0439 \u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u043d\u0433 \u043d\u0435\u00a0\u0432\u0441\u0435\u0433\u0434\u0430 \u0432\u043e\u0437\u043c\u043e\u0436\u0435\u043d. \u041d\u0435\u0442, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u0443\u0447\u0448\u0435!<\/p>\n<h3>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c switch-\u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f!  <\/h3>\n<p>\u041d\u0430\u0447\u0438\u043d\u0430\u044f \u0441\u00a0Java 12\u00a0\u0438 \u0432\u044b\u0448\u0435, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0440\u0435\u0448\u0438\u0442\u044c \u0432\u044b\u0448\u0435\u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c: <\/p>\n<pre><code class=\"java\">boolean result = switch(ternaryBool) {     case TRUE -> true;     case FALSE -> false;     case FILE_NOT_FOUND -> throw new UncheckedIOException(         \"This is ridiculous!\",         new FileNotFoundException());     \/\/ \u0432 \u0432\u0435\u0442\u043a\u0435 `default` \u0443\u0436\u0435 \u043d\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438     default -> throw new IllegalArgumentException(\"Seriously?!\"); }<\/code><\/pre>\n<p>\u042f \u0434\u0443\u043c\u0430\u044e, \u0447\u0442\u043e\u00a0\u044d\u0442\u043e \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e: \u0435\u0441\u043b\u0438 <em>ternartBool <\/em>\u0440\u0430\u0432\u0435\u043d <em>TRUE<\/em>, \u0442\u043e <em>result<\/em> \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u0441\u0432\u043e\u0435\u043d\u043e <em>true, \u0430<\/em> <em>FALSE <\/em>\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f <em>false<\/em>. <\/p>\n<p>\u0421\u0440\u0430\u0437\u0443 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0442 \u0434\u0432\u0435 \u043c\u044b\u0441\u043b\u0438:<\/p>\n<ul>\n<li>\n<p><em>switch <\/em>\u0442\u0435\u043f\u0435\u0440\u044c<em> <\/em>\u043c\u043e\u0436\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442<\/p>\n<\/li>\n<li>\n<p>\u043a\u0430\u043a\u0438\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0441\u0442\u0440\u0435\u043b\u043a\u0438? <\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u0443\u0433\u043b\u0443\u0431\u043b\u044f\u0442\u044c\u0441\u044f \u0432\u00a0\u0434\u0435\u0442\u0430\u043b\u0438 \u043d\u043e\u0432\u044b\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439, \u0432\u043d\u0430\u0447\u0430\u043b\u0435 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043e\u0431\u00a0\u044d\u0442\u0438\u0445 \u0434\u0432\u0443\u0445 \u0430\u0441\u043f\u0435\u043a\u0442\u0430\u0445. <\/p>\n<h3>\u0412\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 vs \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430  <\/h3>\n<p>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0432\u044b \u0443\u0434\u0438\u0432\u043b\u0435\u043d\u044b, \u0447\u0442\u043e <em>switch <\/em>\u0442\u0435\u043f\u0435\u0440\u044c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435\u043c. \u0410\u00a0\u0447\u0435\u043c\u00a0\u0436\u0435 \u043e\u043d\u00a0\u0431\u044b\u043b \u0434\u043e\u00a0\u044d\u0442\u043e\u0433\u043e? \u0414\u043e\u00a0Java 12\u00a0<em>switch <\/em>\u0431\u044b\u043b \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u043c\u00a0\u2014 \u0438\u043c\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0435\u0439, \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0435\u0439 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u044e\u0449\u0438\u043c \u043f\u043e\u0442\u043e\u043a\u043e\u043c.<\/p>\n<p>\u0414\u0443\u043c\u0430\u0439\u0442\u0435 \u043e\u00a0\u0440\u0430\u0437\u043b\u0438\u0447\u0438\u044f\u0445 \u0441\u0442\u0430\u0440\u043e\u0439 \u0438 \u043d\u043e\u0432\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 <em>switch<\/em>, \u043a\u0430\u043a\u00a0\u043e\u00a0\u0440\u0430\u0437\u043d\u0438\u0446\u0435 \u043c\u0435\u0436\u0434\u0443 <em>if<\/em> \u0438 <em>\u0442\u0435\u0440\u043d\u0430\u0440\u043d\u044b\u043c \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u043c<\/em>. \u041e\u043d\u0438 \u043e\u0431\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e\u0442 \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442 \u0442\u0443 \u0438\u043b\u0438\u00a0\u0438\u043d\u0443\u044e \u0432\u0435\u0442\u043a\u0443 \u0432\u00a0\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442\u00a0\u0435\u0433\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430.<\/p>\n<p>\u0420\u0430\u0437\u043d\u0438\u0446\u0430 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0432\u00a0\u0442\u043e\u043c, \u0447\u0442\u043e <em>if<\/em> \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u0431\u043b\u043e\u043a, \u0442\u043e\u0433\u0434\u0430 \u043a\u0430\u043a <em>\u0442\u0435\u0440\u043d\u0430\u0440\u043d\u044b\u0439 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440<\/em> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043a\u0430\u043a\u043e\u0439\u2011\u0442\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:<\/p>\n<pre><code class=\"java\">if(condition) {     result = doThis(); } else {     result = doThat(); }  result = condition ? doThis() : doThat();<\/code><\/pre>\n<p>\u0422\u043e\u00a0\u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u0438 \u0443 <em>switch<\/em>: \u0434\u043e\u00a0Java 12, \u0435\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0435\u043b\u0438 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442, \u0442\u043e \u0434\u043e\u043b\u0436\u043d\u044b\u00a0\u0431\u044b\u043b\u0438\u00a0\u043b\u0438\u0431\u043e \u043f\u0440\u0438\u0441\u0432\u043e\u0438\u0442\u044c \u0435\u0433\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439,\u00a0\u043b\u0438\u0431\u043e \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0438\u0437\u00a0\u043c\u0435\u0442\u043e\u0434\u0430, \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0434\u043b\u044f\u00a0\u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 <em>switch<\/em>. <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c\u00a0\u0436\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 <em>switch <\/em>\u043c\u043e\u0436\u0435\u0442\u00a0\u0431\u044b\u0442\u044c \u043f\u0440\u0438\u0441\u0432\u043e\u0435\u043d \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439.<\/p>\n<p>\u0415\u0449\u0435 \u043e\u0434\u043d\u043e \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432\u00a0\u0442\u043e\u043c, \u0447\u0442\u043e\u00a0\u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0447\u0430\u0441\u0442\u044c\u044e \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430, \u0442\u043e \u043e\u043d\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u0442\u043e\u0447\u043a\u043e\u0439 \u0441\u00a0\u0437\u0430\u043f\u044f\u0442\u043e\u0439, \u0432\u00a0\u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442\u00a0\u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 <em>switch<\/em><\/p>\n<h2>\u0421\u0442\u0440\u0435\u043b\u043a\u0430 vs \u0434\u0432\u043e\u0435\u0442\u043e\u0447\u0438\u044f<\/h2>\n<p>\u0412\u00a0\u0441\u0430\u043c\u043e\u043c \u043d\u0430\u0447\u0430\u043b\u0435 \u0441\u0442\u0430\u0442\u044c\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f \u043f\u0440\u0438\u043c\u0435\u0440 \u0441\u00a0\u043d\u043e\u0432\u044b\u043c \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u043e\u043c \u0432\u00a0\u043b\u044f\u043c\u0431\u0434\u0430\u2011\u0441\u0442\u0438\u043b\u0435 \u0441\u043e \u0441\u0442\u0440\u0435\u043b\u043a\u043e\u0439 \u043c\u0435\u0436\u0434\u0443 \u043c\u0435\u0442\u043a\u043e\u0439 \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0449\u0435\u0439\u0441\u044f \u0447\u0430\u0441\u0442\u044c\u044e. \u042d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u043d\u044b\u0439 \u0435\u043c\u0443 \u043a\u043e\u0434 \u0431\u0435\u0437\u00a0\u043b\u044f\u043c\u0431\u0434\u0430\u2011\u0441\u0442\u0438\u043b\u044f \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0442\u0430\u043a: <\/p>\n<pre><code class=\"java\">boolean result = switch (ternaryBool) {     case TRUE:         yield true;     case FALSE:         yield false;     case FILE_NOT_FOUND:         throw new UncheckedIOException(             \"This is ridiculous!\",             new FileNotFoundException());     default:         throw new IllegalArgumentException(\"Seriously?!\"); }<\/code><\/pre>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e\u00a0\u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u043e\u0432\u043e\u0435 \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e <em>yield<\/em>, \u0447\u0442\u043e\u0431\u044b \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438\u0437\u00a0\u0432\u0435\u0442\u043a\u0438 case (\u044d\u0442\u043e\u0442 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u0432\u00a0Java 13. \u0412\u00a0Java 12\u00a0\u0432\u043c\u0435\u0441\u0442\u043e <em>yield<\/em> \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u043b\u0441\u044f <em>break<\/em>, \u0442.\u00a0\u0435. <em>break true<\/em> \u0432\u043c\u0435\u0441\u0442\u043e <em>yield true, <\/em>\u0447\u0442\u043e\u00a0\u0432\u044b\u0433\u043b\u044f\u0434\u0435\u043b\u043e \u0441\u0442\u0440\u0430\u043d\u043d\u043e).<\/p>\n<p>\u0418\u0441\u0442\u043e\u0440\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u043b\u043e\u0436\u0438\u043b\u043e\u0441\u044c, \u0447\u0442\u043e\u00a0\u043c\u0435\u0442\u043a\u0438 \u0441\u00a0\u0434\u0432\u043e\u0435\u0442\u043e\u0447\u0438\u0435\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0442 \u0442\u043e\u0447\u043a\u0443 \u0432\u0445\u043e\u0434\u0430 \u0432\u00a0\u0431\u043b\u043e\u043a \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432. \u0421\u00a0\u044d\u0442\u043e\u0433\u043e \u043c\u0435\u0441\u0442\u0430 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0433\u043e \u043a\u043e\u0434\u0430 \u043d\u0438\u0436\u0435, \u0434\u0430\u0436\u0435 \u043a\u043e\u0433\u0434\u0430 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u0434\u0440\u0443\u0433\u0430\u044f \u043c\u0435\u0442\u043a\u0430 (\u043f\u0440\u0438 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0438 <em>break<\/em>). \u041c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0442\u0430\u043a\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0438\u0437\u0432\u0435\u0441\u0442\u0435\u043d, \u043a\u0430\u043a\u00a0\u0441\u043a\u0432\u043e\u0437\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u0445\u043e\u0434 \u043a\u00a0\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443 <em>case<\/em>. \u0414\u043b\u044f\u00a0\u0435\u0433\u043e \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f \u043d\u0443\u0436\u0435\u043d <em>break <\/em>\u0438\u043b\u0438 <em>return<\/em>.<\/p>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u00a0\u0436\u0435 \u0441\u0442\u0440\u0435\u043b\u043a\u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0431\u043b\u043e\u043a \u0441\u043f\u0440\u0430\u0432\u0430 \u043e\u0442\u00a0\u043d\u0435\u0435. \u0418 \u043d\u0438\u043a\u0430\u043a\u043e\u0433\u043e \u00ab\u043f\u0440\u043e\u0432\u0430\u043b\u0438\u0432\u0430\u043d\u0438\u044f\u00bb.<\/p>\n<h3>\u041d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u0435\u0442\u043e\u043a \u043d\u0430\u00a0case  <\/h3>\n<p>\u041e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 <em>break<\/em> \u0432 <em>case<\/em> \u0447\u0430\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f\u00a0\u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043a\u00a0\u0432\u0435\u0442\u043a\u0430\u043c \u0441\u00a0\u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u043c\u0435\u0442\u043a\u0430\u043c\u0438<em>. <\/em>\u041f\u0440\u0438\u00a0\u044d\u0442\u043e\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442\u044c \u043a\u00a0\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443 <em>case<\/em>, \u043f\u043e\u043a\u0430 \u043d\u0435\u00a0\u043d\u0430\u0442\u043a\u043d\u0435\u0442\u0441\u044f \u043d\u0430 <em>break. <\/em>\u0418\u0437\u00a0\u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u044b\u0432\u043e\u0434, \u0447\u0442\u043e\u00a0\u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 <em>switch <\/em>\u0432\u00a0\u043a\u0430\u0436\u0434\u043e\u043c <em>case <\/em>\u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u043e\u0439 \u043c\u0435\u0442\u043a\u0438:<\/p>\n<pre><code class=\"java\">switch (number) {     case 1:     case 2:         callMethod(\"few\");         break;     default:         callMethod(\"many\");         break; }<\/code><\/pre>\n<p>\u0410\u00a0\u0432 \u043d\u043e\u0432\u043e\u043c <em>switch <\/em>\u043e\u0434\u0438\u043d <em>case <\/em>\u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c \u043c\u0435\u0442\u043a\u0430\u043c:<\/p>\n<pre><code class=\"java\">String result = switch(ternaryBool) {     case TRUE, FALSE -> \"sane\";     default -> \"insane\"; }<\/code><\/pre>\n<p>\u041f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u044d\u0442\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e: <em>TRUE <\/em>\u0438 <em>FALSE <\/em>\u043f\u0440\u0438\u0432\u043e\u0434\u044f\u0442 \u043a\u00a0\u043e\u0434\u043d\u043e\u043c\u0443 \u0438 \u0442\u043e\u043c\u0443\u00a0\u0436\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0443\u00a0\u2014 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u00absane\u00bb.<\/p>\n<h3>\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e\u00a0\u0441\u0442\u0440\u0435\u043b\u043a\u0435<\/h3>\n<p>\u041d\u0430\u0447\u0438\u043d\u0430\u044f \u0441\u00a0Java 14, <em>switch <\/em>\u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043b\u044f\u043c\u0431\u0434\u0430\u2011\u0441\u0442\u0440\u0435\u043b\u043a\u0443 \u0434\u043b\u044f \u00ab\u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f\u00bb <em>case <\/em>\u0441\u00a0\u043a\u043e\u0434\u043e\u043c:<\/p>\n<pre><code class=\"java\">switch (number) {     case 1 -> callMethod(\"one\");     case 2 -> callMethod(\"two\");     default -> callMethod(\"many\"); }<\/code><\/pre>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0434\u0432\u0430 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430, \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u043d\u044b\u0445 \u0434\u043b\u044f\u00a0\u0441\u0442\u0440\u0435\u043b\u043e\u0447\u043d\u043e\u0439 \u0444\u043e\u0440\u043c\u044b \u0437\u0430\u043f\u0438\u0441\u0438 \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044f:<\/p>\n<ul>\n<li>\n<p> \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u0441\u043a\u0432\u043e\u0437\u043d\u043e\u0433\u043e \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0430 \u043a\u00a0\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443 <em>case<\/em><\/p>\n<\/li>\n<li>\n<p> \u0431\u043b\u043e\u043a\u0438 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432<\/p>\n<\/li>\n<\/ul>\n<h3>\u041e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0430 \u043a\u00a0\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443 case<\/h3>\n<p>\u0412\u043e\u0442, \u0447\u0442\u043e\u00a0\u0433\u043e\u0432\u043e\u0440\u0438\u0442\u0441\u044f \u0432 <a href=\"https:\/\/openjdk.org\/jeps\/325\" rel=\"noopener noreferrer nofollow\">JEP 325<\/a> \u043e\u0431\u00a0\u044d\u0442\u043e\u043c:<\/p>\n<blockquote>\n<p><em>\u0422\u0435\u043a\u0443\u0449\u0438\u0439 \u0434\u0438\u0437\u0430\u0439\u043d \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 switch \u0432\u00a0Java \u0442\u0435\u0441\u043d\u043e \u0441\u0432\u044f\u0437\u0430\u043d \u0441\u00a0\u0442\u0430\u043a\u0438\u043c\u0438 \u044f\u0437\u044b\u043a\u0430\u043c\u0438, \u043a\u0430\u043a\u00a0C \u0438 C++ \u0438 \u043f\u043e\u00a0\u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0441\u043a\u0432\u043e\u0437\u043d\u0443\u044e \u0441\u0435\u043c\u0430\u043d\u0442\u0438\u043a\u0443. \u0425\u043e\u0442\u044f \u044d\u0442\u043e\u0442 \u0442\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0447\u0430\u0441\u0442\u043e \u043f\u043e\u043b\u0435\u0437\u0435\u043d \u0434\u043b\u044f\u00a0\u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043d\u0438\u0437\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u043e\u0433\u043e \u043a\u043e\u0434\u0430 (\u0442\u0430\u043a\u043e\u0433\u043e \u043a\u0430\u043a\u00a0\u043f\u0430\u0440\u0441\u0435\u0440\u044b \u0434\u043b\u044f\u00a0\u0434\u0432\u043e\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f), \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 switch \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432\u00a0\u043a\u043e\u0434\u0435 \u0431\u043e\u043b\u0435\u0435 \u0432\u044b\u0441\u043e\u043a\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f, \u043e\u0448\u0438\u0431\u043a\u0438 \u0442\u0430\u043a\u043e\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0442 \u043f\u0435\u0440\u0435\u0432\u0435\u0448\u0438\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0433\u0438\u0431\u043a\u043e\u0441\u0442\u044c.<\/em><\/p>\n<\/blockquote>\n<p>\u042f \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0441\u043e\u0433\u043b\u0430\u0441\u0435\u043d \u0438 \u043f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <em>switch <\/em>\u0431\u0435\u0437\u00a0\u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043f\u043e\u00a0\u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e:<\/p>\n<pre><code class=\"java\">switch(ternaryBool) {     case TRUE, FALSE -> System.out.println(\"Bool was sane\");     default -> System.out.println(\"Bool was insane\"); }<\/code><\/pre>\n<p>\u0421\u0442\u0440\u0435\u043b\u043a\u0430 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u044b\u0432\u0435\u0441\u0442\u0438 <em>\u00abBool was sane\u00bb<\/em> \u0432\u00a0\u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u043c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0435, \u0432\u00a0\u0442\u043e \u0432\u0440\u0435\u043c\u044f, \u043a\u0430\u043a\u00a0\u0441\u00a0\u0434\u0432\u043e\u0435\u0442\u043e\u0447\u0438\u0435\u043c \u044d\u0442\u043e\u00a0\u0436\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043e\u0442\u043e\u0431\u0440\u0430\u0437\u0438\u043b\u043e\u0441\u044c\u00a0\u0431\u044b \u0434\u0432\u0430\u0436\u0434\u044b.<\/p>\n<h3>\u0411\u043b\u043e\u043a\u0438 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432<\/h3>\n<p>\u041a\u0430\u043a\u00a0\u0438 \u0432\u00a0\u0441\u043b\u0443\u0447\u0430\u0435 \u0441\u00a0\u043b\u044f\u043c\u0431\u0434\u0430\u043c\u0438, \u0441\u0442\u0440\u0435\u043b\u043a\u0430 \u043c\u043e\u0436\u0435\u0442 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c\u00a0\u043b\u0438\u0431\u043e \u043d\u0430\u00a0\u043e\u0434\u0438\u043d \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 (\u043a\u0430\u043a \u0432\u044b\u0448\u0435),\u00a0\u043b\u0438\u0431\u043e \u043d\u0430\u00a0\u0431\u043b\u043e\u043a, \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u0444\u0438\u0433\u0443\u0440\u043d\u044b\u043c\u0438 \u0441\u043a\u043e\u0431\u043a\u0430\u043c\u0438:<\/p>\n<pre><code class=\"java\">boolean result = switch (Bool.random()) {     case TRUE -> {         System.out.println(\"Bool true\");         yield true;     }     case FALSE -> {         System.out.println(\"Bool false\");         yield false;     }     case FILE_NOT_FOUND -> {         var ex = new UncheckedIOException(             \"This is ridiculous!\",             new FileNotFoundException());             throw ex;     }     default -> {         var ex = new IllegalArgumentException(             \"Seriously?!\");             throw ex;     } }<\/code><\/pre>\n<p>\u0411\u043b\u043e\u043a\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b \u0434\u043b\u044f\u00a0\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0431\u043e\u043b\u0435\u0435 \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 \u043a\u043e\u0434\u0430 \u0432 <em>case<\/em>. \u041f\u0440\u0438\u00a0\u044d\u0442\u043e\u043c \u043e\u043d\u0438 \u0438\u043c\u0435\u044e\u0442 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u00a0\u2014 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0435 \u0438\u043c\u0435\u043d\u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0432\u00a0\u0440\u0430\u0437\u043d\u044b\u0445 \u0432\u0435\u0442\u043a\u0430\u0445 \u0437\u0430\u00a0\u0441\u0447\u0435\u0442 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0434\u043b\u044f\u00a0\u043a\u0430\u0436\u0434\u043e\u0439 \u0432\u0435\u0442\u043a\u0438.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0441\u044f \u043d\u0435\u043e\u0431\u044b\u0447\u043d\u044b\u043c \u0441\u043f\u043e\u0441\u043e\u0431 \u0432\u044b\u0445\u043e\u0434\u0430 \u0438\u0437\u00a0\u0431\u043b\u043e\u043a\u043e\u0432 \u0441\u00a0\u043f\u043e\u043c\u043e\u0449\u044c\u044e <em>yield<\/em>, \u0430\u00a0\u043d\u0435 <em>return<\/em>, \u0442\u043e \u044d\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e, \u0447\u0442\u043e\u0431\u044b \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u043f\u0443\u0442\u0430\u043d\u0438\u0446\u044b: <em>return <\/em>\u043c\u043e\u0436\u0435\u0442\u00a0\u0431\u044b\u0442\u044c \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0438\u0441\u0442\u043e\u043b\u043a\u043e\u0432\u0430\u043d, \u043a\u0430\u043a\u00a0\u0432\u044b\u0445\u043e\u0434 \u0438\u0437\u00a0\u043c\u0435\u0442\u043e\u0434\u0430. \u041c\u044b\u00a0\u043b\u0438\u0448\u044c \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u0443 <em>switch<\/em>, \u043e\u0441\u0442\u0430\u0432\u0430\u044f\u0441\u044c \u0432\u00a0\u0442\u043e\u043c\u00a0\u0436\u0435 \u043c\u0435\u0442\u043e\u0434\u0435.<\/p>\n<h3>\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e\u00a0\u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u0445 switch<\/h3>\n<p>\u0418 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435, \u043d\u043e\u00a0\u043d\u0435\u00a0\u043c\u0435\u043d\u0435\u0435 \u0432\u0430\u0436\u043d\u043e\u0435\u00a0\u2014 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f <em>switch <\/em>\u0432\u00a0\u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f:<\/p>\n<ul>\n<li>\n<p>\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f<\/p>\n<\/li>\n<li>\n<p>\u0440\u0430\u043d\u043d\u0438\u0439 \u0432\u043e\u0437\u0432\u0440\u0430\u0442<\/p>\n<\/li>\n<li>\n<p>\u043e\u0445\u0432\u0430\u0442 \u0432\u0441\u0435\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 (\u0438\u0441\u0447\u0435\u0440\u043f\u044b\u0432\u0430\u0435\u043c\u043e\u0441\u0442\u044c)<\/p>\n<\/li>\n<\/ul>\n<h3>\u041c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f<\/h3>\n<p>Switch\u2011\u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c\u0438 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u043c\u0438. \u042d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e\u00a0\u043e\u043d\u0438 \u043d\u0435\u00a0\u0438\u043c\u0435\u044e\u0442 \u0441\u0432\u043e\u0435\u0433\u043e \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e<\/p>\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-347132","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/347132","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=347132"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/347132\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=347132"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=347132"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=347132"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}