{"id":930,"date":"2022-10-19T17:52:58","date_gmt":"2023-10-17T19:29:24","guid":{"rendered":"https:\/\/www.silicloud.com\/ja\/blog\/index.php\/2023\/11\/30\/java-stream%e3%81%aecollect%e3%83%a1%e3%82%bd%e3%83%83%e3%83%89%e3%81%ae%e4%be%8b\/"},"modified":"2025-08-01T03:37:41","modified_gmt":"2025-07-31T18:37:41","slug":"java-stream%e3%81%aecollect%e3%83%a1%e3%82%bd%e3%83%83%e3%83%89%e3%81%ae%e4%be%8b","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/ja\/blog\/java-stream%e3%81%aecollect%e3%83%a1%e3%82%bd%e3%83%83%e3%83%89%e3%81%ae%e4%be%8b\/","title":{"rendered":"Java Stream\u306ecollect()\u30e1\u30bd\u30c3\u30c9\u306e\u4f8b"},"content":{"rendered":"<p>Java Stream\u306ecollect()\u306f\u3001\u30b9\u30c8\u30ea\u30fc\u30e0\u306e\u8981\u7d20\u306b\u5bfe\u3057\u3066\u53ef\u5909\u306e\u96c6\u7d04\u64cd\u4f5c\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002\u3053\u306e\u64cd\u4f5c\u306f\u7d42\u7aef\u64cd\u4f5c\u3067\u3059\u3002<\/p>\n<h2>\u53ef\u5909\u524a\u6e1b\u64cd\u4f5c\u3068\u306f\u4f55\u3067\u3059\u304b\uff1f (Kahen saku gen s\u014dsa to wa nanidesu ka?)<\/h2>\n<p>\u53ef\u5909\u524a\u6e1b\u64cd\u4f5c\u306f\u3001\u30b9\u30c8\u30ea\u30fc\u30e0\u8981\u7d20\u3092\u51e6\u7406\u3057\u3001\u305d\u308c\u3092\u53ef\u5909\u306e\u7d50\u679c\u30b3\u30f3\u30c6\u30ca\u306b\u84c4\u7a4d\u3057\u307e\u3059\u3002\u8981\u7d20\u304c\u51e6\u7406\u3055\u308c\u308b\u3068\u3001\u7d50\u679c\u30b3\u30f3\u30c6\u30ca\u3092\u7d50\u5408\u3059\u308b\u7d50\u5408\u95a2\u6570\u304c\u5b58\u5728\u3057\u3001\u305d\u308c\u306b\u3088\u3063\u3066\u7d50\u679c\u304c\u4f5c\u6210\u3055\u308c\u307e\u3059\u3002<\/p>\n<h2>Java\u306eStream collect()\u30e1\u30bd\u30c3\u30c9\u306e\u30b7\u30b0\u30cd\u30c1\u30e3\u3092\u65e5\u672c\u8a9e\u3067\u66f8\u304d\u63db\u3048\u308b\u3068\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/h2>\n<p>Java Stream\u306ecollect()\u30e1\u30bd\u30c3\u30c9\u306b\u306f2\u3064\u306e\u30d0\u30ea\u30a2\u30f3\u30c8\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>R collect(Supplier supplier, BiConsumer&lt;R, ? super T&gt; accumulator,BiConsumer&lt;R, R&gt; combiner) can be paraphrased as:<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>R collect(Supplier supplier, BiConsumer&lt;R, ? super T&gt; accumulator, BiConsumer&lt;R, R&gt; combiner)\u3092\u5225\u306e\u8a00\u3044\u65b9\u306b\u3059\u308b\u3068\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\uff1a<\/ol>\n<p>\u30b3\u30ec\u30af\u30bf\u30fc\u306f\u3001\u4f9b\u7d66\u8005\u3001\u84c4\u7a4d\u5668\u3001\u304a\u3088\u3073\u7d50\u5408\u5668\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u305f\u3081\u306e\u30e9\u30c3\u30d1\u30fc\u3092\u63d0\u4f9b\u3059\u308b\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u3067\u3059\u30022\u756a\u76ee\u306e\u30e1\u30bd\u30c3\u30c9\u306f\u3001\u30d3\u30eb\u30c8\u30a4\u30f3\u306e\u30b3\u30ec\u30af\u30bf\u30fc\u5b9f\u88c5\u3092\u63d0\u4f9b\u3059\u308b\u305f\u3081\u306bCollectors\u30af\u30e9\u30b9\u3092\u5229\u7528\u3059\u308b\u5834\u5408\u306b\u4fbf\u5229\u3067\u3059\u3002collect()\u95a2\u6570\u306e3\u3064\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u306f\u6b21\u306e\u3068\u304a\u308a\u3067\u3059\u3002<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>\u30b5\u30d7\u30e9\u30a4\u30e4\u30fc\uff1a\u65b0\u3057\u3044\u53ef\u5909\u306e\u7d50\u679c\u30b3\u30f3\u30c6\u30ca\u3092\u4f5c\u6210\u3059\u308b\u6a5f\u80fd\u3002\u4e26\u5217\u5b9f\u884c\u3067\u306f\u3001\u3053\u306e\u95a2\u6570\u306f\u8907\u6570\u56de\u547c\u3073\u51fa\u3055\u308c\u308b\u53ef\u80fd\u6027\u304c\u3042\u308a\u3001\u5404\u547c\u3073\u51fa\u3057\u3067\u65b0\u3057\u3044\u5024\u3092\u8fd4\u3055\u306a\u3051\u308c\u3070\u306a\u308a\u307e\u305b\u3093\u3002<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>\u30a2\u30ad\u30e5\u30e0\u30ec\u30fc\u30bf\uff1a\u8981\u7d20\u3092\u7d50\u679c\u30b3\u30f3\u30c6\u30ca\u306b\u6298\u308a\u305f\u305f\u3080\u72b6\u614b\u3092\u6301\u305f\u306a\u3044\u95a2\u6570\u3002<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\u30b3\u30f3\u30d0\u30a4\u30ca\u30fc\uff1a\u4e8c\u3064\u306e\u90e8\u5206\u7684\u306a\u7d50\u679c\u30b3\u30f3\u30c6\u30ca\u3092\u53d7\u3051\u5165\u308c\u3001\u305d\u308c\u3089\u3092\u30de\u30fc\u30b8\u3059\u308b\u3001\u30a2\u30ad\u30e5\u30e0\u30ec\u30fc\u30bf\u95a2\u6570\u3068\u4e92\u63db\u6027\u304c\u5fc5\u8981\u306a\u72b6\u614b\u3092\u6301\u305f\u306a\u3044\u95a2\u6570\u3002<\/ol>\n<h2>stream.collect()\u30e1\u30bd\u30c3\u30c9\u306e\u4f8b<\/h2>\n<p>Stream.collect()\u30e1\u30bd\u30c3\u30c9\u306e\u3044\u304f\u3064\u304b\u306e\u4f8b\u3092\u898b\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<h3>1. \u6587\u5b57\u5217\u306e\u30ea\u30b9\u30c8\u3092\u7d50\u5408\u3059\u308b<\/h3>\n<p>\u4f8b\u3048\u3070\u3001\u65b0\u3057\u3044\u6587\u5b57\u5217\u3092\u4f5c\u308b\u305f\u3081\u306b\u6587\u5b57\u5217\u306e\u30ea\u30b9\u30c8\u3092\u9023\u7d50\u3057\u305f\u3044\u3068\u3057\u307e\u3057\u3087\u3046\u3002\u79c1\u305f\u3061\u306f\u3001Stream\u306ecollect()\u95a2\u6570\u3092\u4f7f\u7528\u3057\u3066\u3001\u53ef\u5909\u306e\u7e2e\u5c0f\u64cd\u4f5c\u3092\u884c\u3044\u3001\u30ea\u30b9\u30c8\u306e\u8981\u7d20\u3092\u9023\u7d50\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code>List&lt;String&gt; vowels = List.of(\"a\", \"e\", \"i\", \"o\", \"u\");\r\n\r\n\/\/ sequential stream - nothing to combine\r\nStringBuilder result = vowels.stream().collect(StringBuilder::new, (x, y) -&gt; x.append(y),\r\n\t\t(a, b) -&gt; a.append(\",\").append(b));\r\nSystem.out.println(result.toString());\r\n\r\n\/\/ parallel stream - combiner is combining partial results\r\nStringBuilder result1 = vowels.parallelStream().collect(StringBuilder::new, (x, y) -&gt; x.append(y),\r\n\t\t(a, b) -&gt; a.append(\",\").append(b));\r\nSystem.out.println(result1.toString());\r\n<\/code><\/pre>\n<p>\u7d50\u679c: \u51fa\u529b<\/p>\n<pre class=\"post-pre\"><code>aeiou\r\na,e,i,o,u\r\n<\/code><\/pre>\n<ul class=\"post-ul\">\n<li>The supplier function is returning a new StringBuilder object in every call.<\/li>\n<li>The accumulator function is appending the list string element to the StringBuilder instance.<\/li>\n<li>The combiner function is merging the StringBuilder instances. The instances are merged with each other with a comma between them.<\/li>\n<li>In the first case, we have a sequential stream of elements. So they are processed one by one and there is only one instance of StringBuilder. There is no use of the combiner function. That\u2019s why the output produced is \u201caeiou\u201d.<\/li>\n<li>In the second case, we have a parallel stream of strings. So, the elements are processed parallelly and there are multiple instances of StringBuilder that are being merged by the combiner function. Hence, the output produced is \u201ca,e,i,o,u\u201d.<\/li>\n<li>If the stream source is ordered such as List, the collect() method maintains the order while processing. If the stream source is unordered such as Set, then the collect() method can produce different results in each invocation.<\/li>\n<\/ul>\n<p>\u6587\u5b57\u5217\u306e\u30ea\u30b9\u30c8\u3092\u9023\u7d50\u3057\u305f\u3044\u5834\u5408\u3001\u30b3\u30fc\u30c9\u30b5\u30a4\u30ba\u3092\u524a\u6e1b\u3059\u308b\u305f\u3081\u306b\u30e1\u30bd\u30c3\u30c9\u53c2\u7167\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code>String result2 = vowels.parallelStream()\r\n\t\t.collect(StringBuilder::new, StringBuilder::append, StringBuilder::append)\r\n\t\t.toString();\r\n<\/code><\/pre>\n<h3>2. Collectors\u30af\u30e9\u30b9\u3092\u4f7f\u7528\u3057\u3066\u3001Stream collect()\u3092List\u306b\u96c6\u3081\u308b\u3002<\/h3>\n<p>Collectors\u30af\u30e9\u30b9\u306f\u3001Collector\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u306e\u591a\u304f\u306e\u4fbf\u5229\u306a\u5b9f\u88c5\u3092\u63d0\u4f9b\u3057\u307e\u3059\u3002\u6574\u6570\u306e\u30ea\u30b9\u30c8\u304b\u3089\u5076\u6570\u306e\u307f\u3092\u9078\u629e\u3059\u308b\u4f8b\u3092\u898b\u3066\u307f\u307e\u3057\u3087\u3046\u3002Stream\u306efilter()\u306f\u4e2d\u9593\u64cd\u4f5c\u3067\u3042\u308a\u3001\u30b9\u30c8\u30ea\u30fc\u30e0\u3092\u8fd4\u3057\u307e\u3059\u3002\u3057\u305f\u304c\u3063\u3066\u3001\u3053\u306e\u30b9\u30c8\u30ea\u30fc\u30e0\u304b\u3089\u30ea\u30b9\u30c8\u3092\u4f5c\u6210\u3059\u308b\u305f\u3081\u306bcollect()\u95a2\u6570\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code>List&lt;Integer&gt; numbers = List.of(1, 2, 3, 4, 5, 6);\r\n\t\t\r\nList&lt;Integer&gt; evenNumbers = numbers.stream().filter(x -&gt; x % 2 == 0).collect(Collectors.toList());\r\nSystem.out.println(evenNumbers);  \/\/ [2, 4, 6]\r\n<\/code><\/pre>\n<p>Collectors.toList()\u306f\u3001\u5165\u529b\u8981\u7d20\u3092\u65b0\u3057\u3044\u30ea\u30b9\u30c8\u306b\u84c4\u7a4d\u3059\u308bCollector\u306e\u5b9f\u88c5\u3092\u8fd4\u3057\u307e\u3059\u3002<\/p>\n<h3>3. \u30b9\u30c8\u30ea\u30fc\u30e0\u3092collect()\u30e1\u30bd\u30c3\u30c9\u3067Set\u306b\u5909\u63db\u3059\u308b<\/h3>\n<p>\u79c1\u305f\u3061\u306f\u3001Collectors.toSet()\u3092\u4f7f\u7528\u3057\u3066\u3001\u30b9\u30c8\u30ea\u30fc\u30e0\u306e\u8981\u7d20\u3092\u65b0\u3057\u3044Set\u306b\u53ce\u96c6\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code>List&lt;Integer&gt; numbers = List.of(1, 2, 3, 4, 5, 6);\r\n\r\nSet&lt;Integer&gt; oddNumbers = numbers.parallelStream().filter(x -&gt; x % 2 != 0).collect(Collectors.toSet());\r\nSystem.out.println(oddNumbers); \/\/ [1, 3, 5]\r\n<\/code><\/pre>\n<h3>3. \u30b9\u30c8\u30ea\u30fc\u30e0\u306ecollect()\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u3063\u3066Map\u306b\u5909\u63db\u3059\u308b\u3002<\/h3>\n<p>\u30b9\u30c8\u30ea\u30fc\u30e0\u306e\u8981\u7d20\u3092Map\u306b\u96c6\u7d04\u3059\u308b\u305f\u3081\u306b\u3001Collectors.toMap()\u95a2\u6570\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u3053\u306e\u30e1\u30bd\u30c3\u30c9\u306f\u3001Map\u5185\u3067\u306e\u30ad\u30fc\u3068\u5bfe\u5fdc\u3059\u308b\u5024\u306e\u30de\u30c3\u30d4\u30f3\u30b0\u306b\u5bfe\u3057\u30662\u3064\u306e\u5f15\u6570\u3092\u53d7\u3051\u5165\u308c\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code>List&lt;Integer&gt; numbers = List.of(1, 2, 3, 4, 5, 6);\r\n\r\nMap&lt;Integer, String&gt; mapOddNumbers = numbers.parallelStream().filter(x -&gt; x % 2 != 0)\r\n\t\t.collect(Collectors.toMap(Function.identity(), x -&gt; String.valueOf(x)));\r\nSystem.out.println(mapOddNumbers); \/\/ {1=1, 3=3, 5=5}\r\n<\/code><\/pre>\n<h3>4. \u30b3\u30ec\u30af\u30bf\u30fc\u304c\u53c2\u52a0\u3059\u308b\uff08\uff09\u4f8b<\/h3>\n<p>\u79c1\u305f\u3061\u306f\u3001Collectors joining() \u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u5165\u529b\u30b9\u30c8\u30ea\u30fc\u30e0\u306eCharSequence\u8981\u7d20\u3092\u906d\u9047\u3057\u305f\u9806\u306b\u9023\u7d50\u3059\u308bCollector\u3092\u53d6\u5f97\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u3053\u308c\u3092\u4f7f\u7528\u3057\u3066\u3001\u6587\u5b57\u5217\u3001StringBuffer\u3001\u307e\u305f\u306fStringBuilder\u306e\u30b9\u30c8\u30ea\u30fc\u30e0\u3092\u9023\u7d50\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code>jshell&gt; String value = Stream.of(\"a\", \"b\", \"c\").collect(Collectors.joining());\r\nvalue ==&gt; \"abc\"\r\n\r\njshell&gt; String valueCSV = Stream.of(\"a\", \"b\", \"c\").collect(Collectors.joining(\",\"));\r\nvalueCSV ==&gt; \"a,b,c\"\r\n\r\njshell&gt; String valueCSVLikeArray = Stream.of(\"a\", \"b\", \"c\").collect(Collectors.joining(\",\", \"{\", \"}\"));\r\nvalueCSVLikeArray ==&gt; \"{a,b,c}\"\r\n\r\njshell&gt; String valueObject = Stream.of(\"1\", new StringBuffer(\"2\"), new StringBuilder(\"3\")).collect(Collectors.joining());\r\nvalueObject ==&gt; \"123\"\r\n<\/code><\/pre>\n<p>\u51fa\u529b:<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/6564a3e2daa94e2bdf7c34aa\/32-0.png\" alt=\"Java Stream Collect Example\" \/><\/div>\n<h2>\u7d50\u8ad6<\/h2>\n<p>Java\u306eStream\u306ecollect()\u306f\u3001\u4e3b\u306b\u30b9\u30c8\u30ea\u30fc\u30e0\u306e\u8981\u7d20\u3092\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u306b\u96c6\u3081\u308b\u305f\u3081\u306b\u4f7f\u7528\u3055\u308c\u307e\u3059\u3002\u3053\u308c\u306f\u7d42\u7aef\u64cd\u4f5c\u3067\u3059\u3002\u4e26\u5217\u30b9\u30c8\u30ea\u30fc\u30e0\u3068\u4e00\u7dd2\u306b\u4f7f\u7528\u3059\u308b\u969b\u306b\u306f\u3001\u540c\u671f\u51e6\u7406\u3092\u62c5\u5f53\u3057\u307e\u3059\u3002Collectors\u30af\u30e9\u30b9\u306f\u3001\u79c1\u305f\u3061\u3092\u52a9\u3051\u308b\u305f\u3081\u306b\u591a\u304f\u306eCollector\u5b9f\u88c5\u3092\u63d0\u4f9b\u3057\u307e\u3059\u3002<\/p>\n<h2>\u30ea\u30d5\u30a1\u30ec\u30f3\u30b9<\/h2>\n<ul class=\"post-ul\">\n<li>Stream collect() API Doc<\/li>\n<li>Collector Interface<\/li>\n<li>Collectors API Doc<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Java Stream\u306ecollect()\u306f\u3001\u30b9\u30c8\u30ea\u30fc\u30e0\u306e\u8981\u7d20\u306b\u5bfe\u3057\u3066\u53ef\u5909\u306e\u96c6\u7d04\u64cd\u4f5c\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002\u3053\u306e\u64cd\u4f5c\u306f\u7d42\u7aef\u64cd\u4f5c\u3067\u3059\u3002 \u53ef\u5909\u524a\u6e1b\u64cd\u4f5c\u3068\u306f\u4f55\u3067\u3059\u304b\uff1f (Kahen saku gen s\u014dsa to wa nanides [&hellip;]<\/p>\n","protected":false},"author":6,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[26,61],"class_list":["post-930","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-26","tag-61"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.5 (Yoast SEO v21.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Java Stream\u306ecollect()\u30e1\u30bd\u30c3\u30c9\u306e\u4f8b - Blog - Silicon Cloud<\/title>\n<meta name=\"description\" content=\"Java Stream\u306ecollect()\u30e1\u30bd\u30c3\u30c9\u306e\u4f8b\u3092\u5206\u304b\u308a\u3084\u3059\u304f\u89e3\u8aac\u3002\u5b9f\u8df5\u7684\u306a\u4f8b\u3068\u30b3\u30fc\u30c9\u3001\u6ce8\u610f\u70b9\u3092\u542b\u3081\u3066\u521d\u5fc3\u8005\u306b\u3082\u7406\u89e3\u3067\u304d\u308b\u3088\u3046\u8aac\u660e\u3057\u307e\u3059\u3002\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.silicloud.com\/ja\/blog\/java-stream\u306ecollect\u30e1\u30bd\u30c3\u30c9\u306e\u4f8b\/\" \/>\n<meta property=\"og:locale\" content=\"ja_JP\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Java Stream\u306ecollect()\u30e1\u30bd\u30c3\u30c9\u306e\u4f8b\" \/>\n<meta property=\"og:description\" content=\"Java Stream\u306ecollect()\u30e1\u30bd\u30c3\u30c9\u306e\u4f8b\u3092\u5206\u304b\u308a\u3084\u3059\u304f\u89e3\u8aac\u3002\u5b9f\u8df5\u7684\u306a\u4f8b\u3068\u30b3\u30fc\u30c9\u3001\u6ce8\u610f\u70b9\u3092\u542b\u3081\u3066\u521d\u5fc3\u8005\u306b\u3082\u7406\u89e3\u3067\u304d\u308b\u3088\u3046\u8aac\u660e\u3057\u307e\u3059\u3002\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/ja\/blog\/java-stream\u306ecollect\u30e1\u30bd\u30c3\u30c9\u306e\u4f8b\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:published_time\" content=\"2023-10-17T19:29:24+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-07-31T18:37:41+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/6564a3e2daa94e2bdf7c34aa\/32-0.png\" \/>\n<meta name=\"author\" content=\"\u6d77\u6597, \u8475\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u57f7\u7b46\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u6d77\u6597, \u8475\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u63a8\u5b9a\u8aad\u307f\u53d6\u308a\u6642\u9593\" \/>\n\t<meta name=\"twitter:data2\" content=\"12\u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/java-stream%e3%81%aecollect%e3%83%a1%e3%82%bd%e3%83%83%e3%83%89%e3%81%ae%e4%be%8b\/\",\"url\":\"https:\/\/www.silicloud.com\/ja\/blog\/java-stream%e3%81%aecollect%e3%83%a1%e3%82%bd%e3%83%83%e3%83%89%e3%81%ae%e4%be%8b\/\",\"name\":\"Java Stream\u306ecollect()\u30e1\u30bd\u30c3\u30c9\u306e\u4f8b - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#website\"},\"datePublished\":\"2023-10-17T19:29:24+00:00\",\"dateModified\":\"2025-07-31T18:37:41+00:00\",\"author\":{\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/20cfc053626f4d45c0fa7a4e7964b5b6\"},\"description\":\"Java Stream\u306ecollect()\u30e1\u30bd\u30c3\u30c9\u306e\u4f8b\u3092\u5206\u304b\u308a\u3084\u3059\u304f\u89e3\u8aac\u3002\u5b9f\u8df5\u7684\u306a\u4f8b\u3068\u30b3\u30fc\u30c9\u3001\u6ce8\u610f\u70b9\u3092\u542b\u3081\u3066\u521d\u5fc3\u8005\u306b\u3082\u7406\u89e3\u3067\u304d\u308b\u3088\u3046\u8aac\u660e\u3057\u307e\u3059\u3002\",\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/java-stream%e3%81%aecollect%e3%83%a1%e3%82%bd%e3%83%83%e3%83%89%e3%81%ae%e4%be%8b\/#breadcrumb\"},\"inLanguage\":\"ja\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/ja\/blog\/java-stream%e3%81%aecollect%e3%83%a1%e3%82%bd%e3%83%83%e3%83%89%e3%81%ae%e4%be%8b\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/java-stream%e3%81%aecollect%e3%83%a1%e3%82%bd%e3%83%83%e3%83%89%e3%81%ae%e4%be%8b\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.silicloud.com\/ja\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java Stream\u306ecollect()\u30e1\u30bd\u30c3\u30c9\u306e\u4f8b\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#website\",\"url\":\"https:\/\/www.silicloud.com\/ja\/blog\/\",\"name\":\"Blog - Silicon Cloud\",\"description\":\"\",\"inLanguage\":\"ja\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/20cfc053626f4d45c0fa7a4e7964b5b6\",\"name\":\"\u6d77\u6597, \u8475\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ja\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/25aec9a18954b6bfb7e4f7219c2923d62c6f0c9f4d5c0171228fe41751c0ab7a?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/25aec9a18954b6bfb7e4f7219c2923d62c6f0c9f4d5c0171228fe41751c0ab7a?s=96&d=mm&r=g\",\"caption\":\"\u6d77\u6597, \u8475\"},\"url\":\"https:\/\/www.silicloud.com\/ja\/blog\/author\/kaitoaoi\/\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"ja\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/java-stream%e3%81%aecollect%e3%83%a1%e3%82%bd%e3%83%83%e3%83%89%e3%81%ae%e4%be%8b\/#local-main-organization-logo\",\"url\":\"\",\"contentUrl\":\"\",\"caption\":\"Blog - Silicon Cloud\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Java Stream\u306ecollect()\u30e1\u30bd\u30c3\u30c9\u306e\u4f8b - Blog - Silicon Cloud","description":"Java Stream\u306ecollect()\u30e1\u30bd\u30c3\u30c9\u306e\u4f8b\u3092\u5206\u304b\u308a\u3084\u3059\u304f\u89e3\u8aac\u3002\u5b9f\u8df5\u7684\u306a\u4f8b\u3068\u30b3\u30fc\u30c9\u3001\u6ce8\u610f\u70b9\u3092\u542b\u3081\u3066\u521d\u5fc3\u8005\u306b\u3082\u7406\u89e3\u3067\u304d\u308b\u3088\u3046\u8aac\u660e\u3057\u307e\u3059\u3002","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.silicloud.com\/ja\/blog\/java-stream\u306ecollect\u30e1\u30bd\u30c3\u30c9\u306e\u4f8b\/","og_locale":"ja_JP","og_type":"article","og_title":"Java Stream\u306ecollect()\u30e1\u30bd\u30c3\u30c9\u306e\u4f8b","og_description":"Java Stream\u306ecollect()\u30e1\u30bd\u30c3\u30c9\u306e\u4f8b\u3092\u5206\u304b\u308a\u3084\u3059\u304f\u89e3\u8aac\u3002\u5b9f\u8df5\u7684\u306a\u4f8b\u3068\u30b3\u30fc\u30c9\u3001\u6ce8\u610f\u70b9\u3092\u542b\u3081\u3066\u521d\u5fc3\u8005\u306b\u3082\u7406\u89e3\u3067\u304d\u308b\u3088\u3046\u8aac\u660e\u3057\u307e\u3059\u3002","og_url":"https:\/\/www.silicloud.com\/ja\/blog\/java-stream\u306ecollect\u30e1\u30bd\u30c3\u30c9\u306e\u4f8b\/","og_site_name":"Blog - Silicon Cloud","article_published_time":"2023-10-17T19:29:24+00:00","article_modified_time":"2025-07-31T18:37:41+00:00","og_image":[{"url":"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/6564a3e2daa94e2bdf7c34aa\/32-0.png"}],"author":"\u6d77\u6597, \u8475","twitter_card":"summary_large_image","twitter_misc":{"\u57f7\u7b46\u8005":"\u6d77\u6597, \u8475","\u63a8\u5b9a\u8aad\u307f\u53d6\u308a\u6642\u9593":"12\u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/ja\/blog\/java-stream%e3%81%aecollect%e3%83%a1%e3%82%bd%e3%83%83%e3%83%89%e3%81%ae%e4%be%8b\/","url":"https:\/\/www.silicloud.com\/ja\/blog\/java-stream%e3%81%aecollect%e3%83%a1%e3%82%bd%e3%83%83%e3%83%89%e3%81%ae%e4%be%8b\/","name":"Java Stream\u306ecollect()\u30e1\u30bd\u30c3\u30c9\u306e\u4f8b - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/ja\/blog\/#website"},"datePublished":"2023-10-17T19:29:24+00:00","dateModified":"2025-07-31T18:37:41+00:00","author":{"@id":"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/20cfc053626f4d45c0fa7a4e7964b5b6"},"description":"Java Stream\u306ecollect()\u30e1\u30bd\u30c3\u30c9\u306e\u4f8b\u3092\u5206\u304b\u308a\u3084\u3059\u304f\u89e3\u8aac\u3002\u5b9f\u8df5\u7684\u306a\u4f8b\u3068\u30b3\u30fc\u30c9\u3001\u6ce8\u610f\u70b9\u3092\u542b\u3081\u3066\u521d\u5fc3\u8005\u306b\u3082\u7406\u89e3\u3067\u304d\u308b\u3088\u3046\u8aac\u660e\u3057\u307e\u3059\u3002","breadcrumb":{"@id":"https:\/\/www.silicloud.com\/ja\/blog\/java-stream%e3%81%aecollect%e3%83%a1%e3%82%bd%e3%83%83%e3%83%89%e3%81%ae%e4%be%8b\/#breadcrumb"},"inLanguage":"ja","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/ja\/blog\/java-stream%e3%81%aecollect%e3%83%a1%e3%82%bd%e3%83%83%e3%83%89%e3%81%ae%e4%be%8b\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/ja\/blog\/java-stream%e3%81%aecollect%e3%83%a1%e3%82%bd%e3%83%83%e3%83%89%e3%81%ae%e4%be%8b\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.silicloud.com\/ja\/blog\/"},{"@type":"ListItem","position":2,"name":"Java Stream\u306ecollect()\u30e1\u30bd\u30c3\u30c9\u306e\u4f8b"}]},{"@type":"WebSite","@id":"https:\/\/www.silicloud.com\/ja\/blog\/#website","url":"https:\/\/www.silicloud.com\/ja\/blog\/","name":"Blog - Silicon Cloud","description":"","inLanguage":"ja"},{"@type":"Person","@id":"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/20cfc053626f4d45c0fa7a4e7964b5b6","name":"\u6d77\u6597, \u8475","image":{"@type":"ImageObject","inLanguage":"ja","@id":"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/25aec9a18954b6bfb7e4f7219c2923d62c6f0c9f4d5c0171228fe41751c0ab7a?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/25aec9a18954b6bfb7e4f7219c2923d62c6f0c9f4d5c0171228fe41751c0ab7a?s=96&d=mm&r=g","caption":"\u6d77\u6597, \u8475"},"url":"https:\/\/www.silicloud.com\/ja\/blog\/author\/kaitoaoi\/"},{"@type":"ImageObject","inLanguage":"ja","@id":"https:\/\/www.silicloud.com\/ja\/blog\/java-stream%e3%81%aecollect%e3%83%a1%e3%82%bd%e3%83%83%e3%83%89%e3%81%ae%e4%be%8b\/#local-main-organization-logo","url":"","contentUrl":"","caption":"Blog - Silicon Cloud"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/posts\/930","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/comments?post=930"}],"version-history":[{"count":1,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/posts\/930\/revisions"}],"predecessor-version":[{"id":46793,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/posts\/930\/revisions\/46793"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/media?parent=930"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/categories?post=930"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/tags?post=930"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}