{"id":318544,"date":"2021-02-24T15:01:05","date_gmt":"2021-02-24T15:01:05","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=318544"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=318544","title":{"rendered":"\u041c\u0435\u0442\u043e\u0434\u044b \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u0432 Java"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\">\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/d3\/f7\/s9\/d3f7s912i_9vv8vreovq1jcnziy.png\" title=\"Src: https:\/\/cguntur.me\/category\/technology\/java\/java-8\/\"><br \/>  \u0412 \u0442\u0430\u043a\u0438\u0445 \u044f\u0437\u044b\u043a\u0430\u0445 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u043a\u0430\u043a C#, Kotlin, Groovy, Scala \u0435\u0441\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0442\u044c \u043a\u043b\u0430\u0441\u0441 \u043f\u0443\u0442\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043d\u043e\u0432\u043e\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0430, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435 \u0438\u043b\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0441\u0430\u043c\u043e\u0433\u043e \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430. \u042d\u0442\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0439, \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0445 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f. Java, \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u044d\u0442\u0438\u0445 \u044f\u0437\u044b\u043a\u043e\u0432, \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u0442\u0430\u043a\u043e\u0439 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438 \u0438 \u0434\u0430\u0436\u0435 \u043d\u0435 \u043f\u043b\u0430\u043d\u0438\u0440\u0443\u0435\u0442 \u0432 \u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0438\u0445 \u0440\u0435\u043b\u0438\u0437\u0430\u0445. \u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f <a href=\"https:\/\/projectlombok.org\/features\/experimental\/ExtensionMethod\" rel=\"nofollow noopener noreferrer\">Lombok<\/a> \u044d\u0442\u043e \u0441\u0442\u0430\u043b\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u043c. \u041c\u0435\u0442\u043e\u0434\u044b \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u0431\u044b\u043b\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u044b \u0432 Lombok \u0435\u0449\u0435 8 \u043b\u0435\u0442 \u043d\u0430\u0437\u0430\u0434 (\u0441 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u043e\u0439 Eclipse), \u043d\u043e \u0434\u043b\u044f \u043c\u043d\u043e\u0433\u0438\u0445 \u0432\u0441\u0435 \u0443\u043f\u0438\u0440\u0430\u043b\u043e\u0441\u044c \u0432 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 <a href=\"https:\/\/github.com\/mplushnikov\/lombok-intellij-plugin\" rel=\"nofollow noopener noreferrer\">\u043f\u043b\u0430\u0433\u0438\u043d\u043e\u043c \u0432 IDEA<\/a> (\u043a\u043e\u0434 \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043b\u0441\u044f, \u043d\u043e IDE \u0435\u0433\u043e \u043d\u0435 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043b\u0430 \u043a\u0430\u043a \u0432\u0430\u043b\u0438\u0434\u043d\u044b\u0439). Lombok \u043f\u043b\u0430\u0433\u0438\u043d \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0435\u0434\u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d \u0432 <a href=\"https:\/\/www.jetbrains.com\/idea\/nextversion\/\" rel=\"nofollow noopener noreferrer\">IDEA 2021.1 EAP<\/a>, \u0438 \u0442\u0435\u043f\u0435\u0440\u044c \u043e\u043d \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043c\u0435\u0442\u043e\u0434\u044b \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f lombok (\u0441\u043f\u0430\u0441\u0438\u0431\u043e <a href=\"https:\/\/github.com\/akozlova\" rel=\"nofollow noopener noreferrer\">akozlova<\/a>, <a href=\"https:\/\/github.com\/NekoCaffeine\" rel=\"nofollow noopener noreferrer\">NekoCaffeine<\/a> \u0438 <a href=\"https:\/\/github.com\/mplushnikov\" rel=\"nofollow noopener noreferrer\">mplushnikov<\/a>).<br \/>  \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440 \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0438\u043c\u043f\u043e\u0440\u0442\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"java\">import static org.apache.commons.lang3.StringUtils.capitalize;  public class ExtensionMethods {     public static void main(String[] args) {         String str = &quot;test&quot;;         String capitalized = capitalize(str);         \/\/ &quot;Test&quot;         System.out.println(capitalized);     } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0435 \u043d\u0430 \u043c\u0435\u0442\u043e\u0434 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u043a\u043e\u0434 \u0441\u0442\u0430\u043d\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<pre><code class=\"java\">import lombok.experimental.ExtensionMethod; import org.apache.commons.lang3.StringUtils;  @ExtensionMethod(StringUtils.class) public class ExtensionMethods {     public static void main(String[] args) {         String str = &quot;test&quot;;         String capitalized = str.capitalize();         \/\/ &quot;Test&quot;         System.out.println(capitalized);     } }<\/code><\/pre>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<p>\u0417\u0430\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u044f \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0432 \u0441\u043a\u043e\u0431\u043a\u0438 \u0437\u0430\u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f \u043d\u0430 \u0446\u0435\u043f\u043e\u0447\u043a\u0438 \u0432\u044b\u0437\u043e\u0432\u043e\u0432, \u0442.\u0435. \u043a\u043e\u0434 \u0432\u0438\u0434\u0430 <code>call3(call2(call1(arg)))<\/code> \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u0442\u0441\u044f \u0432<\/p>\n<p>  <\/p>\n<pre><code class=\"java\">arg.call1()     .call2()     .call3();<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412\u043e \u043c\u043d\u043e\u0433\u0438\u0445 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f\u0445 \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043e\u0431\u043b\u0435\u0433\u0447\u0438\u0442\u044c \u0447\u0442\u0435\u043d\u0438\u0435 \u043a\u043e\u0434\u0430, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u043a\u043e\u0433\u0434\u0430 \u0446\u0435\u043f\u043e\u0447\u043a\u0438 \u0434\u043b\u0438\u043d\u043d\u044b\u0435, \u0437\u0434\u0435\u0441\u044c \u0435\u0441\u0442\u044c \u043d\u0435\u043a\u0430\u044f \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u044f \u0441\u043e <code>Stream Api<\/code> \u0438\u043b\u0438 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f <code>java.util.Optional<\/code>.<br \/>  \u0424\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0441\u0430\u0445\u0430\u0440. \u041a\u043e\u0434 \u043f\u0440\u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043c\u0435\u043d\u0435\u043d \u043d\u0430 \u0432\u044b\u0437\u043e\u0432 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430. \u041f\u0435\u0440\u0432\u044b\u0439 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 \u0438 \u0441\u0442\u0430\u043d\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u043c &quot;<code>this<\/code>&quot;.<\/p>\n<p>  <\/p>\n<h2 id=\"null-znacheniya\">null-\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f<\/h2>\n<p>  <\/p>\n<p>\u0412 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u043e\u0431\u044b\u0447\u043d\u044b\u0445 instance-\u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u043c\u0435\u0442\u043e\u0434\u044b \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u043c\u043e\u0433\u0443\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0438 \u0441 null-\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438, \u0442.\u0435. \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 \u0432\u043f\u043e\u043b\u043d\u0435 \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c:<\/p>\n<p>  <\/p>\n<pre><code class=\"java\">import org.apache.commons.lang3.StringUtils;  @ExtensionMethod(StringUtils.class) public class MethodExtensions {     public static void main(String[] args) throws Exception {         String nullStr = null;         \/\/ &quot;isEmpty=true&quot;         System.out.println(&quot;isEmpty=&quot; + nullStr.trimToEmpty().isEmpty());     } }<\/code><\/pre>\n<p>  <\/p>\n<h2 id=\"esche-primery\">\u0415\u0449\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b<\/h2>\n<p>  <\/p>\n<p>\u041c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 \u043f\u0440\u043e\u0435\u043a\u0442 \u043d\u0430 JDK 8 \u043c\u0435\u0442\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0432 JDK 11:<\/p>\n<p>  <\/p>\n<pre><code class=\"java\">@UtilityClass public class CollectionExtensions {     public static &lt;T&gt; T[] toArray(Collection&lt;T&gt; list, IntFunction&lt;T[]&gt; generator) {         return list.stream().toArray(generator);     } }  @ExtensionMethod(CollectionExtensions.class) public class MethodExtensions {     public static void main(String[] args) throws Exception {         List&lt;Integer&gt; list = Arrays.asList(1, 2, 3);         \/\/ toArray(IntFunction&lt;T[]&gt;) \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d \u0442\u043e\u043b\u044c\u043a\u043e \u0432 Java 11         Integer[] array = list.toArray(Integer[]::new);         \/\/ &quot;[1, 2, 3]&quot;         System.out.println(Arrays.toString(array));     } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0418\u043b\u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u043b\u0430\u043a\u043e\u043d\u0438\u0447\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 <code>Stream.collect(toList()):<\/code><\/p>\n<p>  <\/p>\n<pre><code class=\"java\">@UtilityClass public class StreamExtensions {     public static &lt;T&gt; List&lt;T&gt; toList(Stream&lt;T&gt; stream) {         return stream.collect(Collectors.toList());     } }  @ExtensionMethod(StreamExtensions.class) public class MethodExtensions {     public static void main(String[] args) throws Exception {         List&lt;Integer&gt; list = Arrays.asList(3, 1, 2);         List&lt;Integer&gt; sorted = list.stream()                 .sorted()                 .toList();          \/\/ &quot;[1, 2, 3]&quot;         System.out.println(sorted);     } }<\/code><\/pre>\n<p>  <\/p>\n<h2 id=\"nastroyka-proekta\">\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/h2>\n<p>  <\/p>\n<ul>\n<li>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044e\u044e \u0432\u0435\u0440\u0441\u0438\u044e <a href=\"https:\/\/www.jetbrains.com\/idea\/nextversion\/\" rel=\"nofollow noopener noreferrer\">IDEA EAP<\/a>, \u0432\u0430\u0436\u043d\u043e: EAP \u0432\u0435\u0440\u0441\u0438\u0438 \u043d\u0435 \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u044b, \u0437\u0430\u0442\u043e \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u044b. \u041f\u043b\u0430\u0433\u0438\u043d \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0438 \u0432 Ultimate, \u0438 \u0432 Community Edition.<\/li>\n<li>\u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c lombok: <a href=\"https:\/\/projectlombok.org\/setup\/maven\" rel=\"nofollow noopener noreferrer\">maven<\/a><\/li>\n<\/ul>\n<p>  <\/p>\n<pre><code class=\"xml\">&lt;dependency&gt;     &lt;groupId&gt;org.projectlombok&lt;\/groupId&gt;     &lt;artifactId&gt;lombok&lt;\/artifactId&gt;     &lt;version&gt;1.18.16&lt;\/version&gt;     &lt;scope&gt;provided&lt;\/scope&gt; &lt;\/dependency&gt;<\/code><\/pre>\n<p>  <\/p>\n<p>\u043b\u0438\u0431\u043e \u0434\u043b\u044f <a href=\"https:\/\/projectlombok.org\/setup\/gradle\" rel=\"nofollow noopener noreferrer\">gradle<\/a>:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">compileOnly 'org.projectlombok:lombok:1.18.16' annotationProcessor 'org.projectlombok:lombok:1.18.16' testCompileOnly 'org.projectlombok:lombok:1.18.16' testAnnotationProcessor 'org.projectlombok:lombok:1.18.16'<\/code><\/pre>\n<p>  <\/p>\n<ul>\n<li>\u0423\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0430 \u043e\u043f\u0446\u0438\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u0430 <code>Build, Execution, Deployment<\/code> -&gt; <code>Compiler<\/code> -&gt; <code>Annotations processor<\/code> -&gt; <code>Enable annotation processing<\/code><\/li>\n<li>\u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044e <code>@ExtensionMethod<\/code> \u043d\u0430 \u043a\u043b\u0430\u0441\u0441 (\u043e\u0442\u043a\u0443\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0437\u043e\u0432), \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u044f\u044f \u0432\u0441\u0435 \u0443\u0442\u0438\u043b\u0438\u0442\u043d\u044b\u0435 \u043a\u043b\u0430\u0441\u0441\u044b, \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u044b\u0437\u043e\u0432\u044b.<\/li>\n<\/ul>\n<\/div>\n<p> \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\/527688\/\"> https:\/\/habr.com\/ru\/post\/527688\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\">\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/d3\/f7\/s9\/d3f7s912i_9vv8vreovq1jcnziy.png\" title=\"Src: https:\/\/cguntur.me\/category\/technology\/java\/java-8\/\"><br \/>  \u0412 \u0442\u0430\u043a\u0438\u0445 \u044f\u0437\u044b\u043a\u0430\u0445 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u043a\u0430\u043a C#, Kotlin, Groovy, Scala \u0435\u0441\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0442\u044c \u043a\u043b\u0430\u0441\u0441 \u043f\u0443\u0442\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043d\u043e\u0432\u043e\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0430, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435 \u0438\u043b\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0441\u0430\u043c\u043e\u0433\u043e \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430. \u042d\u0442\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0439, \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0445 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f. Java, \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u044d\u0442\u0438\u0445 \u044f\u0437\u044b\u043a\u043e\u0432, \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u0442\u0430\u043a\u043e\u0439 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438 \u0438 \u0434\u0430\u0436\u0435 \u043d\u0435 \u043f\u043b\u0430\u043d\u0438\u0440\u0443\u0435\u0442 \u0432 \u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0438\u0445 \u0440\u0435\u043b\u0438\u0437\u0430\u0445. \u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f <a href=\"https:\/\/projectlombok.org\/features\/experimental\/ExtensionMethod\" rel=\"nofollow noopener noreferrer\">Lombok<\/a> \u044d\u0442\u043e \u0441\u0442\u0430\u043b\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u043c. \u041c\u0435\u0442\u043e\u0434\u044b \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u0431\u044b\u043b\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u044b \u0432 Lombok \u0435\u0449\u0435 8 \u043b\u0435\u0442 \u043d\u0430\u0437\u0430\u0434 (\u0441 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u043e\u0439 Eclipse), \u043d\u043e \u0434\u043b\u044f \u043c\u043d\u043e\u0433\u0438\u0445 \u0432\u0441\u0435 \u0443\u043f\u0438\u0440\u0430\u043b\u043e\u0441\u044c \u0432 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 <a href=\"https:\/\/github.com\/mplushnikov\/lombok-intellij-plugin\" rel=\"nofollow noopener noreferrer\">\u043f\u043b\u0430\u0433\u0438\u043d\u043e\u043c \u0432 IDEA<\/a> (\u043a\u043e\u0434 \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043b\u0441\u044f, \u043d\u043e IDE \u0435\u0433\u043e \u043d\u0435 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043b\u0430 \u043a\u0430\u043a \u0432\u0430\u043b\u0438\u0434\u043d\u044b\u0439). Lombok \u043f\u043b\u0430\u0433\u0438\u043d \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0435\u0434\u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d \u0432 <a href=\"https:\/\/www.jetbrains.com\/idea\/nextversion\/\" rel=\"nofollow noopener noreferrer\">IDEA 2021.1 EAP<\/a>, \u0438 \u0442\u0435\u043f\u0435\u0440\u044c \u043e\u043d \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043c\u0435\u0442\u043e\u0434\u044b \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f lombok (\u0441\u043f\u0430\u0441\u0438\u0431\u043e <a href=\"https:\/\/github.com\/akozlova\" rel=\"nofollow noopener noreferrer\">akozlova<\/a>, <a href=\"https:\/\/github.com\/NekoCaffeine\" rel=\"nofollow noopener noreferrer\">NekoCaffeine<\/a> \u0438 <a href=\"https:\/\/github.com\/mplushnikov\" rel=\"nofollow noopener noreferrer\">mplushnikov<\/a>).<br \/>  \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440 \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0438\u043c\u043f\u043e\u0440\u0442\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"java\">import static org.apache.commons.lang3.StringUtils.capitalize;  public class ExtensionMethods {     public static void main(String[] args) {         String str = &quot;test&quot;;         String capitalized = capitalize(str);         \/\/ &quot;Test&quot;         System.out.println(capitalized);     } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0435 \u043d\u0430 \u043c\u0435\u0442\u043e\u0434 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u043a\u043e\u0434 \u0441\u0442\u0430\u043d\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<pre><code class=\"java\">import lombok.experimental.ExtensionMethod; import org.apache.commons.lang3.StringUtils;  @ExtensionMethod(StringUtils.class) public class ExtensionMethods {     public static void main(String[] args) {         String str = &quot;test&quot;;         String capitalized = str.capitalize();         \/\/ &quot;Test&quot;         System.out.println(capitalized);     } }<\/code><\/pre>\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-318544","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/318544","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=318544"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/318544\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=318544"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=318544"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=318544"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}