{"id":6181,"date":"2012-12-11T23:49:04","date_gmt":"2012-12-11T14:49:04","guid":{"rendered":"http:\/\/arison.jp\/blog\/?p=6181"},"modified":"2017-02-25T22:26:13","modified_gmt":"2017-02-25T13:26:13","slug":"join-separator-program-idiom","status":"publish","type":"post","link":"https:\/\/arison.jp\/blog\/2012\/12\/11\/join-separator-program-idiom\/","title":{"rendered":"\u3010Java\u3011\u30bb\u30d1\u30ec\u30fc\u30c8\u3092\u3064\u3051\u308b\u30d7\u30ed\u30b0\u30e9\u30e0\u30a4\u30c7\u30a3\u30aa\u30e0\u96c6"},"content":{"rendered":"<p>\u30bb\u30d1\u30ec\u30fc\u30c8\u3092\u3064\u3051\u308b\u30d7\u30ed\u30b0\u30e9\u30e0\u3063\u3066\u7d50\u69cb\u8a18\u8ff0\u3059\u308b\u3053\u3068\u304c\u591a\u3044\u3002<br \/>\n\u30ab\u30f3\u30de\u533a\u5207\u308a(csv)\u3001\u30bf\u30d6\u533a\u5207\u308a(tsv)\u3001\u30b9\u30da\u30fc\u30b9\u533a\u5207\u308a\u3068\u304b\u304c\u591a\u3044\u3002<br \/>\n\u3060\u3044\u305f\u3044\u3001\u6700\u5f8c\u306b\u4f59\u5206\u306a\u30bb\u30d1\u30ec\u30fc\u30c8\u3092\u524a\u9664\u3059\u308b\u304b\u3001\u521d\u56de\u306e\u307f\u30bb\u30d1\u30ec\u30fc\u30c8\u3092\u8ffd\u52a0\u3057\u306a\u3044<br \/>\n\u3063\u3066\u3084\u3063\u3066\u3044\u305f\u3093\u3060\u3051\u3069\u3001\u7d20\u6674\u3089\u3057\u3044\u30d7\u30ed\u30b0\u30e9\u30e0\u30a4\u30c7\u30a3\u30aa\u30e0\u3092\u77e5\u3063\u305f\u3002<\/p>\n<p><!--more--><\/p>\n<p><a href=\"http:\/\/pgkiss.web.fc2.com\/idiom\/splitter.html\" title=\"\u4f55\u304b\u3067\u533a\u5207\u308b\u3059\u308b\u8868\u73fe\u3001splitter - Java\u3068\u304b\u3067\u5b66\u3076\u3001\u3059\u3050\u306b\u4f7f\u3044\u305f\u304f\u306a\u308b\u6d17\u7df4\u3055\u308c\u305f\u30d7\u30ed\u30b0\u30e9\u30e0\u30a4\u30c7\u30a3\u30aa\u30e0\u96c6\">\u4f55\u304b\u3067\u533a\u5207\u308b\u3059\u308b\u8868\u73fe\u3001splitter &#8211; Java\u3068\u304b\u3067\u5b66\u3076\u3001\u3059\u3050\u306b\u4f7f\u3044\u305f\u304f\u306a\u308b\u6d17\u7df4\u3055\u308c\u305f\u30d7\u30ed\u30b0\u30e9\u30e0\u30a4\u30c7\u30a3\u30aa\u30e0\u96c6<\/a><br \/>\nhttp:\/\/pgkiss.web.fc2.com\/idiom\/splitter.html<\/p>\n<p><a href=\"http:\/\/pgkiss.web.fc2.com\/idiom\/ifRemover.html\" title=\"if\u6587\u6d88\u3057\u30b4\u30e0 - Java\u3068\u304b\u3067\u5b66\u3076\u3001\u3059\u3050\u306b\u4f7f\u3044\u305f\u304f\u306a\u308b\u6d17\u7df4\u3055\u308c\u305f\u30d7\u30ed\u30b0\u30e9\u30e0\u30a4\u30c7\u30a3\u30aa\u30e0\u96c6\">if\u6587\u6d88\u3057\u30b4\u30e0 &#8211; Java\u3068\u304b\u3067\u5b66\u3076\u3001\u3059\u3050\u306b\u4f7f\u3044\u305f\u304f\u306a\u308b\u6d17\u7df4\u3055\u308c\u305f\u30d7\u30ed\u30b0\u30e9\u30e0\u30a4\u30c7\u30a3\u30aa\u30e0\u96c6<\/a><br \/>\nhttp:\/\/pgkiss.web.fc2.com\/idiom\/ifRemover.html<\/p>\n<p>\u672b\u5c3e\u306e\u30bb\u30d1\u30ec\u30fc\u30c8\u3092\u6d88\u3059\u3001\u6700\u521d\u306e\u30bb\u30d1\u30ec\u30fc\u30c8\u3092\u6d88\u3059\u3068\u3044\u3046\u51e6\u7406\u304c\u3042\u308b\u3051\u3069\u3002<br \/>\n[java]<br \/>\nstatic String join(String separator, Iterable&lt;?&gt; list) {<br \/>\n    StringBuilder result = new StringBuilder();<br \/>\n    String delimiter = &quot;&quot;;<br \/>\n    for (Object e : list) {<br \/>\n        result.append(delimiter);<br \/>\n        result.append(e.toString());<br \/>\n        delimiter = separator;<br \/>\n    }<br \/>\n    return result.toString();<br \/>\n}<br \/>\n[\/java]<\/p>\n<blockquote><p>\n<span class=\"font20px\">\u6700\u521d\u306e\u533a\u5207\u308a\u3092\u51fa\u529b\u3057\u306a\u3044\u306e\u3067\u306f\u306a\u304f\u3001\u6700\u521d\u3060\u3051\u7a7a\u6587\u5b57\u5217\u3092\u533a\u5207\u308a\u3068\u3057\u3066\u51fa\u529b\u3059\u308b\u3053\u3068\u3067\u3001if\u6587\u3092\u4e0d\u8981\u306b\u3057\u3066\u3044\u308b\u3002<\/span><\/p>\n<p>\u6587\u5b57\u5217\u306e\u9023\u7d50\u306e\u5834\u5408\u3001\u7a7a\u6587\u5b57\u5217\u3092\u9023\u7d50\u3059\u308b\u3053\u3068\u306f\u4f55\u3082\u3057\u306a\u3044\u3053\u3068\u3068\u540c\u3058\u3060\u3002<\/p>\n<p><span class=\"font20px\">\u4f55\u3082\u3057\u306a\u3044\u3053\u3068\u3068\u540c\u7b49\u306a\u64cd\u4f5c\u3092NOP(NO Operation)\u3068\u3044\u3046\u304c(\u3082\u3068\u3082\u3068\u30a2\u30bb\u30f3\u30d6\u30ea\u8a00\u8a9e\u306e\u547d\u4ee4)\u3001\u3053\u306e\u5834\u5408\u7a7a\u6587\u5b57\u5217\u306fNOP\u306b\u3042\u305f\u308b\u3002<br \/>\nNOP\u3092\u3046\u307e\u304f\u4f7f\u3046\u3053\u3068\u3067\u3001\u7279\u5225\u6271\u3044\u3057\u306a\u3051\u308c\u3070\u306a\u3089\u306a\u3044\u30d1\u30bf\u30fc\u30f3\u3092\u53d6\u308a\u9664\u304d\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u30b7\u30f3\u30d7\u30eb\u306b\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u5834\u5408\u304c\u3042\u308b\u3002 <\/span>\n<\/p><\/blockquote>\n<p>\u591a\u5c11\u3001\u51e6\u7406\u306f\u91cd\u305f\u3044\u304b\u3082\u3057\u308c\u306a\u3044\u3051\u3069\u3001\u53ef\u8aad\u6027\u3082\u3044\u3044\u3057\u3001\u3053\u308c\u304b\u3089\u306f\u3053\u306e\u65b9\u6cd5\u3092\u4f7f\u304a\u3046\u3063\u3068\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u30bb\u30d1\u30ec\u30fc\u30c8\u3092\u3064\u3051\u308b\u30d7\u30ed\u30b0\u30e9\u30e0\u3063\u3066\u7d50\u69cb\u8a18\u8ff0\u3059\u308b\u3053\u3068\u304c\u591a\u3044\u3002 \u30ab\u30f3\u30de\u533a\u5207\u308a(csv)\u3001\u30bf\u30d6\u533a\u5207\u308a(tsv)\u3001\u30b9\u30da\u30fc\u30b9\u533a\u5207\u308a\u3068\u304b\u304c\u591a\u3044\u3002 \u3060\u3044\u305f\u3044\u3001\u6700\u5f8c\u306b\u4f59\u5206\u306a\u30bb\u30d1\u30ec\u30fc\u30c8\u3092\u524a\u9664\u3059\u308b\u304b\u3001\u521d\u56de\u306e\u307f\u30bb\u30d1\u30ec\u30fc\u30c8\u3092\u8ffd\u52a0\u3057\u306a\u3044 \u3063\u3066\u3084\u3063\u3066 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":17178,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,4],"tags":[703],"class_list":["post-6181","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-programming","category-diary","tag-java"],"_links":{"self":[{"href":"https:\/\/arison.jp\/blog\/wp-json\/wp\/v2\/posts\/6181","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/arison.jp\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/arison.jp\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/arison.jp\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/arison.jp\/blog\/wp-json\/wp\/v2\/comments?post=6181"}],"version-history":[{"count":0,"href":"https:\/\/arison.jp\/blog\/wp-json\/wp\/v2\/posts\/6181\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/arison.jp\/blog\/wp-json\/wp\/v2\/media\/17178"}],"wp:attachment":[{"href":"https:\/\/arison.jp\/blog\/wp-json\/wp\/v2\/media?parent=6181"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/arison.jp\/blog\/wp-json\/wp\/v2\/categories?post=6181"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/arison.jp\/blog\/wp-json\/wp\/v2\/tags?post=6181"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}