{"id":582,"date":"2023-10-02T13:50:09","date_gmt":"2023-10-02T13:50:09","guid":{"rendered":"http:\/\/emacslisp.com\/?p=582"},"modified":"2023-10-02T13:50:09","modified_gmt":"2023-10-02T13:50:09","slug":"java-stream-parallelstream","status":"publish","type":"post","link":"http:\/\/emacslisp.com\/?p=582","title":{"rendered":"Java Stream &#8211; ParallelStream"},"content":{"rendered":"\n<p>Multiple All BigInteger in Array using Parallel Stream and reduce<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>package com.dw.thread;\r\n\r\nimport java.math.BigInteger;\r\nimport java.util.ArrayList;\r\nimport java.util.List;\r\n\r\npublic class ParallelStreamTest {\r\n    public static void main(String&#91;] args) {\r\n        List&lt;BigInteger> integers = new ArrayList&lt;>();\r\n\/\/ fill data\r\n        integers.add(new BigInteger(\"134123124325234234\"));\r\n        integers.add(new BigInteger(\"1341231243252\"));\r\n        integers.add(new BigInteger(\"134123124325234234\"));\r\n        integers.add(new BigInteger(\"134123124325234234\"));\r\n        integers.add(new BigInteger(\"134123124\"));\r\n        integers.add(new BigInteger(\"134123124\"));\r\n        integers.add(new BigInteger(\"134123124\"));\r\n        integers.add(new BigInteger(\"134123124\"));\r\n        integers.add(new BigInteger(\"134123124\"));\r\n\r\n        BigInteger result = integers.parallelStream()\r\n                .reduce(BigInteger.ONE, (a, e) -> a.multiply(e));\r\n        System.out.println(result);\r\n\r\n    }\r\n}\r\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Multiple All BigInteger in Array using Parallel Stream and reduce<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[14],"tags":[],"class_list":["post-582","post","type-post","status-publish","format-standard","hentry","category-java"],"_links":{"self":[{"href":"http:\/\/emacslisp.com\/index.php?rest_route=\/wp\/v2\/posts\/582","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/emacslisp.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/emacslisp.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/emacslisp.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/emacslisp.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=582"}],"version-history":[{"count":1,"href":"http:\/\/emacslisp.com\/index.php?rest_route=\/wp\/v2\/posts\/582\/revisions"}],"predecessor-version":[{"id":583,"href":"http:\/\/emacslisp.com\/index.php?rest_route=\/wp\/v2\/posts\/582\/revisions\/583"}],"wp:attachment":[{"href":"http:\/\/emacslisp.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=582"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/emacslisp.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=582"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/emacslisp.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=582"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}