{"id":581,"date":"2021-01-21T18:55:27","date_gmt":"2021-01-21T10:55:27","guid":{"rendered":"http:\/\/www.mimiq.com.cn\/?p=581"},"modified":"2021-01-21T18:55:27","modified_gmt":"2021-01-21T10:55:27","slug":"deepops%e7%9a%84%e5%b7%a5%e5%85%b7%e5%b0%8f%e7%ac%94%e8%ae%b0-intellij-idea-%e4%b8%89%e4%b8%aa%e7%ae%80%e5%8c%96%e4%bb%a3%e7%a0%81%e7%9a%84%e5%b0%8f%e6%8a%80%e5%b7%a73-ways-to-simplify-your-code","status":"publish","type":"post","link":"http:\/\/www.mimiq.com.cn\/?p=581","title":{"rendered":"DeepOps\u7684\u5de5\u5177\u5c0f\u7b14\u8bb0-IntelliJ IDEA \u4e09\u4e2a\u7b80\u5316\u4ee3\u7801\u7684\u5c0f\u6280\u5de7(3 ways to simplify your code )"},"content":{"rendered":"\n<p>\u4eca\u5929\u770b\u5230\u4e86\u4e00\u4e2a\u8bb2\u7b80\u5316\u4ee3\u7801\u7684\u51e0\u4e2a\u5c0fTIPS\uff0c\u8bb0\u5f55\u4e00\u4e0b\uff0c\u61d2\u5f97\u770b\u7684\u53ea\u770b\u6700\u4e0a\u9762\u7684\u603b\u7ed3\u5c31\u884c\u4e86<\/p>\n\n\n\n<p>1.1 Methods\uff08\u65b9\u6cd5\uff09<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Command+option+M\uff08macOS\uff09\nCtrl+Alt+M\uff08windows\/linux\uff09 \n<\/code><\/pre>\n\n\n\n<p>1.2 Constants \u5e38\u91cf<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Command+option+C\uff08macOS\uff09\nCtrl+Alt+C\uff08windows\/linux\uff09  \n<\/code><\/pre>\n\n\n\n<p>1.3 Fields<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Command+option+F\uff08macOS\uff09\nCtrl+Alt+F\uff08windows\/linux\uff09 \n<\/code><\/pre>\n\n\n\n<p>1.4 Variables\u53d8\u91cf<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Command+option+V\uff08macOS\uff09\nCtrl+Alt+V\uff08windows\/linux\uff09  \n<\/code><\/pre>\n\n\n\n<p>1.5 Parameters\u53c2\u6570<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Command+option+P\uff08macOS\uff09\nCtrl+Alt+P\uff08windows\/linux\uff09  \n<\/code><\/pre>\n\n\n\n<p>1.6 Inline\uff08\u5185\u5d4c\uff09<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Command+option+N\uff08macOS\uff09\nCtrl+Alt+N\uff08windows\/linux\uff09  \n<\/code><\/pre>\n\n\n\n<p>2.Change Signature<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Command+F6\uff08macOS\uff09\nCtrl+F6\uff08windows\/linux\uff09 \n<\/code><\/pre>\n\n\n\n<p>3.Rename\uff08\u91cd\u547d\u540d\uff09<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Shift+F6\uff08macOS\uff09\nShift+F6\uff08windows\/linux\uff09\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h1>1.Extract \/ Inline\uff08\u63d0\u53d6\/\u5185\u8054\uff09<\/h1>\n\n\n\n<h2>1.1 Methods\uff08\u65b9\u6cd5\uff09<\/h2>\n\n\n\n<p><strong>Command+option+M\uff08macOS\uff09<br>Ctrl+Alt+M\uff08windows\/linux\uff09<\/strong><br>\u7b2c\u4e00\u6b65 \u9009\u4e2d\u9700\u8981\u63d0\u53d6\u7684\u4ee3\u7801\u5757<br><img src=\"https:\/\/img-blog.csdnimg.cn\/20210120131230771.png?x-oss-process=image\/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L29wcGVybGlsaQ==,size_16,color_FFFFFF,t_70#pic_center\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\"><\/p>\n\n\n\n<p>\u7b2c\u4e8c\u6b65 \u6309\u4e0bCtrl+Alt+M \u4f1a\u5c06\u9009\u4e2d\u4ee3\u7801\u63d0\u53d6\u5230\u4e00\u4e2a\u65b9\u6cd5\u4e2d\uff0c\u91cd\u65b0\u547d\u540d\u65b9\u6cd5\u540d\u5373\u53ef<br><img src=\"https:\/\/img-blog.csdnimg.cn\/20210120131244946.png?x-oss-process=image\/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L29wcGVybGlsaQ==,size_16,color_FFFFFF,t_70#pic_center\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\"><\/p>\n\n\n\n<h2>1.2 Constants \u5e38\u91cf<\/h2>\n\n\n\n<p><strong>Command+option+C\uff08macOS\uff09<br>Ctrl+Alt+C\uff08windows\/linux\uff09<\/strong><br>\u63d0\u53d6\u5e38\u91cf\uff0c\u9009\u62e9\u9700\u8981\u63d0\u53d6\u7684\u6570\u503c\uff0c\u6309Ctrl+Alt+C<br><img src=\"https:\/\/img-blog.csdnimg.cn\/20210120131256412.png?x-oss-process=image\/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L29wcGVybGlsaQ==,size_16,color_FFFFFF,t_70#pic_center\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\"><\/p>\n\n\n\n<p>\u4fee\u6539\u5e38\u91cf\u7684\u540d\u79f0\uff0c\u5b8c\u6210\u5e38\u91cf\u63d0\u53d6\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img src=\"https:\/\/img-blog.csdnimg.cn\/20210120131306661.png?x-oss-process=image\/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L29wcGVybGlsaQ==,size_16,color_FFFFFF,t_70#pic_center\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\"\/><\/figure>\n\n\n\n<h2>1.3 Fields<\/h2>\n\n\n\n<p><strong>Command+option+F\uff08macOS\uff09<br>Ctrl+Alt+F\uff08windows\/linux\uff09<\/strong><br>\u5c06\u91cd\u590d\u4f7f\u7528\u7684\u6587\u672c\u63d0\u53d6\u51fa\u6765\uff0c\u589e\u52a0\u4ee3\u7801\u7684\u53ef\u8bfb\u6027<br>\u9009\u4e2d\u9700\u8981\u63d0\u53d6\u7684\u6587\u672c\u5185\u5bb9<br><img src=\"https:\/\/img-blog.csdnimg.cn\/20210120131336709.png?x-oss-process=image\/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L29wcGVybGlsaQ==,size_16,color_FFFFFF,t_70#pic_center\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\"><\/p>\n\n\n\n<p>\u6309 Ctrl+Alt+F \u5728\u5bf9\u8bdd\u6846\u4e2d\u8bbe\u7f6e\u597d\u6587\u672cfield\u7684\u540d\u79f0\uff0c\u8bbf\u95ee\u6743\u9650\uff0c\u4ee5\u53ca\u66ff\u6362\u7684\u9009\u9879<br><img src=\"https:\/\/img-blog.csdnimg.cn\/2021012013134773.png?x-oss-process=image\/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L29wcGVybGlsaQ==,size_16,color_FFFFFF,t_70#pic_center\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\"><\/p>\n\n\n\n<p>\u70b9\u51fbok\u540e\u4f1a\u5c06\u8fd9\u4e9b\u6587\u672c\u5185\u5bb9\u63d0\u53d6\u51fa\u6765\uff0c\u5982\u4e0b\u56fe\u7ea2\u6846\u6240\u793a\u3002<br><img src=\"https:\/\/img-blog.csdnimg.cn\/20210120131356866.png?x-oss-process=image\/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L29wcGVybGlsaQ==,size_16,color_FFFFFF,t_70#pic_center\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\"><\/p>\n\n\n\n<h2>1.4 Variables\u53d8\u91cf<\/h2>\n\n\n\n<p><strong>Command+option+V\uff08macOS\uff09<br>Ctrl+Alt+V\uff08windows\/linux\uff09<\/strong><br>\u633a\u957f\u7684\u4e00\u6bb5\u4ee3\u7801\uff0c\u5728\u4f7f\u7528\u7684\u65f6\u5019\uff0c\u53ef\u8bfb\u6027\u8981\u5dee\u4e00\u4e9b\uff0c\u8fd9\u4e2a\u65b9\u6cd5\u5c31\u662f\u6559\u5927\u5bb6\u5982\u4f55\u628a\u4e00\u6bb5\u4ee3\u7801\u63d0\u53d6\u4e3a\u53d8\u91cf\u3002<br>\u9996\u5148\u9009\u62e9\u9700\u8981\u63d0\u53d6\u7684\u5185\u5bb9\uff0c\u6309Ctrl+Alt+V\uff0c\u518d\u63d0\u793a\u6846\u4e2d\u9009\u62e9\u9700\u8981\u63d0\u53d6\u7684\u5185\u5bb9\u3002\u53ef\u4ee5\u6839\u636e\u81ea\u5df1\u9700\u8981\u9009\u62e9\u63d0\u53d6\u7684\u5185\u5bb9\uff08\u7b97\u4e0alength\u65b9\u6cd5\uff0c\u8fd8\u662f\u4e0d\u7b97length\u65b9\u6cd5\uff0c\u90fd\u770b\u4e2a\u4eba\u559c\u597d\uff09\u3002<br><img src=\"https:\/\/img-blog.csdnimg.cn\/20210120131406624.png?x-oss-process=image\/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L29wcGVybGlsaQ==,size_16,color_FFFFFF,t_70#pic_center\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\"><\/p>\n\n\n\n<p>\u786e\u8ba4\u540e\uff0c\u9700\u8981\u91cd\u547d\u540d\u4e00\u4e0b\u53d8\u91cf\u540d\u79f0\uff0cIDEA\u4f1a\u81ea\u52a8\u91cd\u6784\u76f8\u5173\u4ee3\u7801\u3002<br><img src=\"https:\/\/img-blog.csdnimg.cn\/20210120131415581.png?x-oss-process=image\/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L29wcGVybGlsaQ==,size_16,color_FFFFFF,t_70#pic_center\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\"><\/p>\n\n\n\n<h2>1.5 Parameters\u53c2\u6570<\/h2>\n\n\n\n<p><strong>Command+option+P\uff08macOS\uff09<br>Ctrl+Alt+P\uff08windows\/linux\uff09<\/strong><br>\u63d0\u53d6\u53c2\u6570\uff0c\u5c06\u4ee3\u7801\u4e2d\u91cd\u590d\u4f7f\u7528\u7684\u5185\u5bb9\uff0c\u63d0\u53d6\u4e3a\u65b9\u6cd5\u7684\u53c2\u6570\u3002<br>\u9009\u4e2d\u9700\u8981\u63d0\u53d6\u7684\u5185\u5bb9\uff0c\u6309Ctrl+Alt+P<br><img src=\"https:\/\/img-blog.csdnimg.cn\/20210120131426737.png?x-oss-process=image\/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L29wcGVybGlsaQ==,size_16,color_FFFFFF,t_70#pic_center\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\"><\/p>\n\n\n\n<p>\u518d\u63d0\u793a\u6846\u4e2d\uff0c\u9009\u62e9\u597d\u53c2\u6570\u540d\u79f0\u4ee5\u53ca\u66ff\u6362\u7684\u8303\u56f4\u3002\u70b9\u51fb\u91cd\u6784\u3002<br><img src=\"https:\/\/img-blog.csdnimg.cn\/20210120131436328.png?x-oss-process=image\/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L29wcGVybGlsaQ==,size_16,color_FFFFFF,t_70#pic_center\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\"><\/p>\n\n\n\n<p>\u91cd\u6784\u540e\u7684\u4ee3\u7801\uff0c\u4f1a\u5728\u65b9\u6cd5\u4e2d\u589e\u52a0\u4e00\u4e2a\u53c2\u6570\uff0c\u66ff\u6362\u65b9\u6cd5\u63d0\u4e2d\u7684\u5185\u5bb9\uff0c\u53e6\u5916\u8c03\u7528\u8be5\u65b9\u6cd5\u7684\u4ee3\u7801\u4e5f\u4f1a\u76f8\u5e94\u8c03\u6574\u3002<br><img src=\"https:\/\/img-blog.csdnimg.cn\/202101201314507.png?x-oss-process=image\/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L29wcGVybGlsaQ==,size_16,color_FFFFFF,t_70#pic_center\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\"><\/p>\n\n\n\n<h2>1.6 Inline\uff08\u5185\u5d4c\uff09<\/h2>\n\n\n\n<p><strong>Command+option+N\uff08macOS\uff09<br>Ctrl+Alt+N\uff08windows\/linux\uff09<\/strong><br>\u5982\u679c\u60f3\u5c06\u63d0\u53d6\u51fa\u6765\u7684\u65b9\u6cd5\u5185\u5d4c\u56de\u53bb\uff0c\u5219\u53ef\u4ee5\u4f7f\u7528\u8fd9\u4e2a\u5feb\u6377\u952e\u8fdb\u884c\u64cd\u4f5c\u3002<br>\u9009\u4e2d\u9700\u8981\u5185\u5d4c\u7684\u65b9\u6cd5\uff0c\u6309Ctrl+Alt+N\uff0c\u9009\u62e9\u76f8\u5e94\u7684\u5185\u5d4c\u65b9\u5f0f\uff08\u6240\u6709\u90fd\u5185\u5d4c\u8fdb\u6765\u8fd8\u662f\u5355\u4e2a\u5185\u5d4c\uff1f\u662f\u5426\u79fb\u9664\u65b9\u6cd5\uff1f\u8fd9\u4e9b\u90fd\u53ef\u4ee5\u81ea\u5df1\u9009\u62e9\uff09<br><img src=\"https:\/\/img-blog.csdnimg.cn\/20210120131501999.png?x-oss-process=image\/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L29wcGVybGlsaQ==,size_16,color_FFFFFF,t_70#pic_center\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\"><\/p>\n\n\n\n<p>\u91cd\u6784\u540e\uff0c\u65b9\u6cd5\u7684\u5b9e\u73b0\u5c31\u4f1a\u88ab\u5185\u5d4c\u5230\u8c03\u7528\u7684\u65b9\u6cd5\u4e2d\u3002<br><img src=\"https:\/\/img-blog.csdnimg.cn\/20210120131518130.png?x-oss-process=image\/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L29wcGVybGlsaQ==,size_16,color_FFFFFF,t_70#pic_center\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\"><\/p>\n\n\n\n<h1>2.Change Signature \uff08\u8fd9\u4e2a\u4e0d\u77e5\u9053\u600e\u4e48\u7ffb\u8bd1\u5408\u9002\uff0c\u66f4\u6539\u65b9\u6cd5\u7684\u53c2\u6570\u7279\u5f81\uff1f\uff09<\/h1>\n\n\n\n<p><strong>Command+F6\uff08macOS\uff09<br>Ctrl+F6\uff08windows\/linux\uff09<\/strong><br>\u9009\u4e2d\u53c2\u6570\uff0c\u6309\u4e0bCtrl+F6\uff0c\u51fa\u73b0\u4e0b\u9762\u7684\u5bf9\u8bdd\u6846\u540e<br><img src=\"https:\/\/img-blog.csdnimg.cn\/20210120131532490.png?x-oss-process=image\/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L29wcGVybGlsaQ==,size_16,color_FFFFFF,t_70#pic_center\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\"><\/p>\n\n\n\n<p>\u4e0a\u8ff0\u6b65\u9aa4\u64cd\u4f5c\u7ed3\u675f\u4e4b\u540e\uff0c\u65b9\u6cd5\u4f1a\u589e\u52a0\u4e00\u4e2aseason\u7684\u53c2\u6570\u3002<br><img src=\"https:\/\/img-blog.csdnimg.cn\/20210120131546237.png?x-oss-process=image\/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L29wcGVybGlsaQ==,size_16,color_FFFFFF,t_70#pic_center\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\"><\/p>\n\n\n\n<p>IDEA\u4f1a\u81ea\u52a8\u91cd\u6784\u6240\u6709\u8c03\u7528\u7684\u65b9\u6cd5\uff0c\u5bf9\u4e8e\u589e\u52a0\u7684\u53c2\u6570\uff0c\u4f1a\u76f4\u63a5\u8d4b\u4e88\u4e00\u4e2a\u9ed8\u8ba4\u503c\uff0c\u5982\u4e0b\u56fe\u6240\u793a\uff0c\u65b0\u589e\u52a0\u7684\u53c2\u6570\u4f7f\u7528summer\u4f5c\u4e3a\u9ed8\u8ba4\u503c\u3002<br><img src=\"https:\/\/img-blog.csdnimg.cn\/20210120131556926.png?x-oss-process=image\/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L29wcGVybGlsaQ==,size_16,color_FFFFFF,t_70#pic_center\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\"><\/p>\n\n\n\n<h1>3.Rename\uff08\u91cd\u547d\u540d\uff09<\/h1>\n\n\n\n<p><strong>Shift+F6\uff08macOS\uff09<br>Shift+F6\uff08windows\/linux\uff09<\/strong><br>\u9009\u4e2d\u65b9\u6cd5\u540d\uff0c\u7136\u540e\u6309Shift+F6 \u4e4b\u540e\u4fee\u6539\u65b9\u6cd5\u540d<br><img src=\"https:\/\/img-blog.csdnimg.cn\/20210120131611624.png?x-oss-process=image\/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L29wcGVybGlsaQ==,size_16,color_FFFFFF,t_70#pic_center\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\"><\/p>\n\n\n\n<p>\u4fee\u6539\u540e\u65b9\u6cd5\u540d\u70b9\u51fb\u540e\u9762\u7684\u56fe\u6807\uff0c\u4f1a\u5f39\u51fa\u91cd\u547d\u540d\u7684\u9009\u9879\u6846\uff0c\u9009\u62e9\u4e4b\u540e\u56de\u8f66\u5373\u5b8c\u6210\u91cd\u6784\u3002<br><img src=\"https:\/\/img-blog.csdnimg.cn\/20210120131621670.png?x-oss-process=image\/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L29wcGVybGlsaQ==,size_16,color_FFFFFF,t_70#pic_center\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\"><\/p>\n\n\n\n<p>\u4e5f\u53ef\u4ee5\u70b9\u51fb\u4e0a\u56fe\u4e2d\u7684more options\uff0c\u5f39\u51fa\u6846\u4e2d\u53ef\u4ee5\u9009\u62e9\u66f4\u591a\u5185\u5bb9\u3002\u91cd\u547d\u540d\u201c\u7c7b\u201d\u548c\u201c\u65b9\u6cd5\u201d\uff0c\u53ef\u4ee5\u70b9\u51fb\u201cpreview\u201d\u6309\u94ae\u9884\u89c8\u91cd\u547d\u540d\u5185\u5bb9\u3002\u4e5f\u53ef\u4ee5\u70b9\u51fb\u201crefactor\u201d\u76f4\u63a5\u91cd\u6784\uff08\u8fd9\u4e2a\u56fe\u662f\u672c\u673a\u5668\u622a\u56fe\uff0c\u8ddf\u5b98\u65b9\u89c6\u9891\u6709\u70b9\u4e0d\u4e00\u6837\uff09<br><img src=\"https:\/\/img-blog.csdnimg.cn\/20210120131631799.png?x-oss-process=image\/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L29wcGVybGlsaQ==,size_16,color_FFFFFF,t_70#pic_center\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\"><img src=\"https:\/\/img-blog.csdnimg.cn\/20210120131641511.png?x-oss-process=image\/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L29wcGVybGlsaQ==,size_16,color_FFFFFF,t_70#pic_center\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\"><\/p>\n\n\n\n<p>\u70b9\u51fb\u9884\u89c8\u6309\u94ae\uff0c\u53ef\u4ee5\u67e5\u770b\u5230\u90fd\u6709\u54ea\u4e9b\u5185\u5bb9\u4f1a\u88ab\u91cd\u6784<br><img src=\"https:\/\/img-blog.csdnimg.cn\/20210120131652408.png?x-oss-process=image\/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L29wcGVybGlsaQ==,size_16,color_FFFFFF,t_70#pic_center\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\"><\/p>\n\n\n\n<p>\u91cd\u6784\u4e4b\u540e\uff0c\u4f1a\u66ff\u6362\u6389\u7c7b\u7684\u540d\u5b57\u548c\u6ce8\u91ca\u4e2d\u7684\u540d\u5b57\uff0c\u4e5f\u4f1a\u66ff\u6362\u6389\u5176\u4ed6\u8c03\u7528\u8fd9\u4e2a\u7c7b\u7684\u540d\u5b57\u3002\u53e6\u5916\u8fd9\u4e2a\u66ff\u6362\u662f\u5927\u5c0f\u5199\u654f\u611f\u7684\u3002<br><img src=\"https:\/\/img-blog.csdnimg.cn\/20210120131702766.png?x-oss-process=image\/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L29wcGVybGlsaQ==,size_16,color_FFFFFF,t_70#pic_center\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4eca\u5929\u770b\u5230\u4e86\u4e00\u4e2a\u8bb2\u7b80\u5316\u4ee3\u7801\u7684\u51e0\u4e2a\u5c0fTIPS\uff0c\u8bb0\u5f55\u4e00\u4e0b\uff0c\u61d2\u5f97\u770b\u7684\u53ea\u770b\u6700\u4e0a\u9762\u7684\u603b\u7ed3\u5c31\u884c\u4e86 1.1 Methods\uff08\u65b9\u6cd5\uff09 1.2 Constants \u5e38\u91cf 1.3 Fields 1.4 Variables\u53d8\u91cf 1.5 Parameters\u53c2\u6570 1.6 Inline\uff08\u5185\u5d4c\uff09 2.Change Signature 3.Rename\uff08\u91cd\u547d\u540d\uff09 1.Extract \/ Inline\uff08\u63d0\u53d6\/\u5185\u8054\uff09 1.1 Methods\uff08\u65b9\u6cd5\uff09 Command+option+M\uff08macOS\uff09Ctrl+Alt+M\uff08windows\/linux\uff09\u7b2c\u4e00\u6b65 \u9009\u4e2d\u9700\u8981\u63d0\u53d6\u7684\u4ee3\u7801\u5757 \u7b2c\u4e8c\u6b65 \u6309\u4e0bCtrl+Alt+M \u4f1a\u5c06\u9009\u4e2d\u4ee3\u7801\u63d0\u53d6\u5230\u4e00\u4e2a\u65b9\u6cd5\u4e2d\uff0c\u91cd\u65b0\u547d\u540d\u65b9\u6cd5\u540d\u5373\u53ef 1.2 Constants \u5e38\u91cf Command+option+C\uff08macOS\uff09Ctrl+Alt+C\uff08windows\/linux\uff09\u63d0\u53d6\u5e38\u91cf\uff0c\u9009\u62e9\u9700\u8981\u63d0\u53d6\u7684\u6570\u503c\uff0c\u6309Ctrl+Alt+C \u4fee\u6539\u5e38\u91cf\u7684\u540d\u79f0\uff0c\u5b8c\u6210\u5e38\u91cf\u63d0\u53d6\u3002 1.3 Fields Command+option+F\uff08macOS\uff09Ctrl+Alt+F\uff08windows\/linux\uff09\u5c06\u91cd\u590d\u4f7f\u7528\u7684\u6587\u672c\u63d0\u53d6\u51fa\u6765\uff0c\u589e\u52a0\u4ee3\u7801\u7684\u53ef\u8bfb\u6027\u9009\u4e2d\u9700\u8981\u63d0\u53d6\u7684\u6587\u672c\u5185\u5bb9 \u6309 Ctrl+Alt+F \u5728\u5bf9\u8bdd\u6846\u4e2d\u8bbe\u7f6e\u597d\u6587\u672cfield\u7684\u540d\u79f0\uff0c\u8bbf\u95ee\u6743\u9650\uff0c\u4ee5\u53ca\u66ff\u6362\u7684\u9009\u9879 \u70b9\u51fbok\u540e\u4f1a\u5c06\u8fd9\u4e9b\u6587\u672c\u5185\u5bb9\u63d0\u53d6\u51fa\u6765\uff0c\u5982\u4e0b\u56fe\u7ea2\u6846\u6240\u793a\u3002 1.4 Variables\u53d8\u91cf Command+option+V\uff08macOS\uff09Ctrl+Alt+V\uff08windows\/linux\uff09\u633a\u957f\u7684\u4e00\u6bb5\u4ee3\u7801\uff0c\u5728\u4f7f\u7528\u7684\u65f6\u5019\uff0c\u53ef\u8bfb\u6027\u8981\u5dee\u4e00\u4e9b\uff0c\u8fd9\u4e2a\u65b9\u6cd5\u5c31\u662f\u6559\u5927\u5bb6\u5982\u4f55\u628a\u4e00\u6bb5\u4ee3\u7801\u63d0\u53d6\u4e3a\u53d8\u91cf\u3002\u9996\u5148\u9009\u62e9\u9700\u8981\u63d0\u53d6\u7684\u5185\u5bb9\uff0c\u6309Ctrl+Alt+V\uff0c\u518d\u63d0\u793a\u6846\u4e2d\u9009\u62e9\u9700\u8981\u63d0\u53d6\u7684\u5185\u5bb9\u3002\u53ef\u4ee5\u6839\u636e\u81ea\u5df1\u9700\u8981\u9009\u62e9\u63d0\u53d6\u7684\u5185\u5bb9\uff08\u7b97\u4e0alength\u65b9\u6cd5\uff0c\u8fd8\u662f\u4e0d\u7b97length\u65b9\u6cd5\uff0c\u90fd\u770b\u4e2a\u4eba\u559c\u597d\uff09\u3002 \u786e\u8ba4\u540e\uff0c\u9700\u8981\u91cd\u547d\u540d\u4e00\u4e0b\u53d8\u91cf\u540d\u79f0\uff0cIDEA\u4f1a\u81ea\u52a8\u91cd\u6784\u76f8\u5173\u4ee3\u7801\u3002 1.5 Parameters\u53c2\u6570 Command+option+P\uff08macOS\uff09Ctrl+Alt+P\uff08windows\/linux\uff09\u63d0\u53d6\u53c2\u6570\uff0c\u5c06\u4ee3\u7801\u4e2d\u91cd\u590d\u4f7f\u7528\u7684\u5185\u5bb9\uff0c\u63d0\u53d6\u4e3a\u65b9\u6cd5\u7684\u53c2\u6570\u3002\u9009\u4e2d\u9700\u8981\u63d0\u53d6\u7684\u5185\u5bb9\uff0c\u6309Ctrl+Alt+P \u518d\u63d0\u793a\u6846\u4e2d\uff0c\u9009\u62e9\u597d\u53c2\u6570\u540d\u79f0\u4ee5\u53ca\u66ff\u6362\u7684\u8303\u56f4\u3002\u70b9\u51fb\u91cd\u6784\u3002 \u91cd\u6784\u540e\u7684\u4ee3\u7801\uff0c\u4f1a\u5728\u65b9\u6cd5\u4e2d\u589e\u52a0\u4e00\u4e2a\u53c2\u6570\uff0c\u66ff\u6362\u65b9\u6cd5\u63d0\u4e2d\u7684\u5185\u5bb9\uff0c\u53e6\u5916\u8c03\u7528\u8be5\u65b9\u6cd5\u7684\u4ee3\u7801\u4e5f\u4f1a\u76f8\u5e94\u8c03\u6574\u3002 1.6 Inline\uff08\u5185\u5d4c\uff09 Command+option+N\uff08macOS\uff09Ctrl+Alt+N\uff08windows\/linux\uff09\u5982\u679c\u60f3\u5c06\u63d0\u53d6\u51fa\u6765\u7684\u65b9\u6cd5\u5185\u5d4c\u56de\u53bb\uff0c\u5219\u53ef\u4ee5\u4f7f\u7528\u8fd9\u4e2a\u5feb\u6377\u952e\u8fdb\u884c\u64cd\u4f5c\u3002\u9009\u4e2d\u9700\u8981\u5185\u5d4c\u7684\u65b9\u6cd5\uff0c\u6309Ctrl+Alt+N\uff0c\u9009\u62e9\u76f8\u5e94\u7684\u5185\u5d4c\u65b9\u5f0f\uff08\u6240\u6709\u90fd\u5185\u5d4c\u8fdb\u6765\u8fd8\u662f\u5355\u4e2a\u5185\u5d4c\uff1f\u662f\u5426\u79fb\u9664\u65b9\u6cd5\uff1f\u8fd9\u4e9b\u90fd\u53ef\u4ee5\u81ea\u5df1\u9009\u62e9\uff09 \u91cd\u6784\u540e\uff0c\u65b9\u6cd5\u7684\u5b9e\u73b0\u5c31\u4f1a\u88ab\u5185\u5d4c\u5230\u8c03\u7528\u7684\u65b9\u6cd5\u4e2d\u3002 2.Change Signature \uff08\u8fd9\u4e2a\u4e0d\u77e5\u9053\u600e\u4e48\u7ffb\u8bd1\u5408\u9002\uff0c\u66f4\u6539\u65b9\u6cd5\u7684\u53c2\u6570\u7279\u5f81\uff1f\uff09 &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"\" href=\"http:\/\/www.mimiq.com.cn\/?p=581\"> <span class=\"screen-reader-text\">DeepOps\u7684\u5de5\u5177\u5c0f\u7b14\u8bb0-IntelliJ IDEA \u4e09\u4e2a\u7b80\u5316\u4ee3\u7801\u7684\u5c0f\u6280\u5de7(3 ways to simplify your code )<\/span> Read More &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[27],"tags":[],"_links":{"self":[{"href":"http:\/\/www.mimiq.com.cn\/index.php?rest_route=\/wp\/v2\/posts\/581"}],"collection":[{"href":"http:\/\/www.mimiq.com.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.mimiq.com.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.mimiq.com.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.mimiq.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=581"}],"version-history":[{"count":1,"href":"http:\/\/www.mimiq.com.cn\/index.php?rest_route=\/wp\/v2\/posts\/581\/revisions"}],"predecessor-version":[{"id":582,"href":"http:\/\/www.mimiq.com.cn\/index.php?rest_route=\/wp\/v2\/posts\/581\/revisions\/582"}],"wp:attachment":[{"href":"http:\/\/www.mimiq.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=581"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.mimiq.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=581"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.mimiq.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=581"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}