Path: csiph.com!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Eric Sosman Newsgroups: comp.lang.java.programmer Subject: Re: parallel stream with return Date: Thu, 1 Oct 2015 08:22:58 -0400 Organization: A noiseless patient Spider Lines: 14 Message-ID: References: <20d1db19-e4b1-45ec-8acd-effcf8fac6a7@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Thu, 1 Oct 2015 12:21:01 +0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="858a9d65d95f4ea4d355bd116aa2cdbf"; logging-data="19411"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/OSOA6t1CCPccITJUBulvi" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 In-Reply-To: <20d1db19-e4b1-45ec-8acd-effcf8fac6a7@googlegroups.com> Cancel-Lock: sha1:OYMuG6FxnYZ4tXWgznRHyxb/mnU= Xref: csiph.com comp.lang.java.programmer:32745 On 10/1/2015 2:36 AM, Philipp Kraus wrote: > Am Mittwoch, 30. September 2015 22:54:04 UTC+2 schrieb Jeff Higgins: > >> IntStream.range(0, 4096).parallel() >> .forEachOrdered(i -> { x.add(generate(i)); }); > > Did I understand It correct, that I need the forEachOrdered to create the equal order like in the intstream range? So if I need only 4k objects and the order is irrelevant I can do this with forEach. If the calls to generate() must occur in a particular order, you'd better not use parallel() ... -- esosman@comcast-dot-net.invalid "Don't be afraid of work. Make work afraid of you." -- TLM