{"id":7626,"date":"2023-02-20T13:48:27","date_gmt":"2023-02-20T04:48:27","guid":{"rendered":"https:\/\/www.skyer9.pe.kr\/wordpress\/?p=7626"},"modified":"2023-02-20T13:48:27","modified_gmt":"2023-02-20T04:48:27","slug":"java-objectutils-isempty","status":"publish","type":"post","link":"https:\/\/www.skyer9.pe.kr\/wordpress\/?p=7626","title":{"rendered":"Java &#8211; ObjectUtils.isEmpty()"},"content":{"rendered":"<h1>Java &#8211; ObjectUtils.isEmpty()<\/h1>\n<p><code>ObjectUtils.isEmpty()<\/code> \uc758 \uc0ac\uc6a9\ubc95\uc744 \uc815\ub9ac\ud574 \ubd05\ub2c8\ub2e4.<\/p>\n<h2>\uc18c\uc2a4\ucf54\ub4dc<\/h2>\n<pre><code class=\"language-java\">public static boolean isEmpty(@Nullable Object obj) {\n    if (obj == null) {\n        return true;\n    }\n\n    if (obj instanceof Optional) {\n        return !((Optional&lt;?&gt;) obj).isPresent();\n    }\n    if (obj instanceof CharSequence) {\n        return ((CharSequence) obj).length() == 0;\n    }\n    if (obj.getClass().isArray()) {\n        return Array.getLength(obj) == 0;\n    }\n    if (obj instanceof Collection) {\n        return ((Collection&lt;?&gt;) obj).isEmpty();\n    }\n    if (obj instanceof Map) {\n        return ((Map&lt;?, ?&gt;) obj).isEmpty();\n    }\n\n    \/\/ else\n    return false;\n}<\/code><\/pre>\n<h2>\uc124\uba85<\/h2>\n<ol>\n<li>\uac12\uc774 null \uc774\uba74 true \uc785\ub2c8\ub2e4.<\/li>\n<li>Optional \uc740 isEmpty() \uc774\uba74 true \uc785\ub2c8\ub2e4.<\/li>\n<li>\ubb38\uc790\uc5f4\uc740 \uc0ac\uc774\uc988\uac00 0 \uc774\uba74 true \uc785\ub2c8\ub2e4.<\/li>\n<li>\ubc30\uc5f4\/\uceec\ub799\uc158\uc740 \uc0ac\uc774\uc988\uac00 0 \uc774\uac70\ub098 isEmpty() \uc774\uba74 true \uc785\ub2c8\ub2e4.<\/li>\n<li>\uc22b\uc790\ub294 null \uc774 \uc544\ub2c8\uba74 false \uc785\ub2c8\ub2e4.<\/li>\n<li>Enum \uc740 null \uc774 \uc544\ub2c8\uba74 false \uc785\ub2c8\ub2e4.<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>Java &#8211; ObjectUtils.isEmpty() ObjectUtils.isEmpty() \uc758 \uc0ac\uc6a9\ubc95\uc744 \uc815\ub9ac\ud574 \ubd05\ub2c8\ub2e4. \uc18c\uc2a4\ucf54\ub4dc public static boolean isEmpty(@Nullable Object obj) { if (obj == null) { return true; } if (obj instanceof Optional) { return !((Optional&lt;?&gt;) obj).isPresent(); } if (obj instanceof CharSequence) { return ((CharSequence) obj).length() == 0; } if (obj.getClass().isArray()) { return Array.getLength(obj) == 0; } if (obj instanceof\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.skyer9.pe.kr\/wordpress\/?p=7626\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-7626","post","type-post","status-publish","format-standard","hentry","category-java"],"_links":{"self":[{"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/7626","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7626"}],"version-history":[{"count":1,"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/7626\/revisions"}],"predecessor-version":[{"id":7627,"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/7626\/revisions\/7627"}],"wp:attachment":[{"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7626"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7626"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7626"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}