Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #31435

Re: .parallelStream()

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.albasani.net!.POSTED!not-for-mail
From Sebastian <news@seyweiler.dyndns.org>
Newsgroups comp.lang.java.programmer
Subject Re: .parallelStream()
Date Wed, 01 Apr 2015 16:42:07 +0200
Organization albasani.net
Lines 18
Message-ID <mfh040$icm$1@news.albasani.net> (permalink)
References <parallelStream-20150401160329@ram.dialup.fu-berlin.de>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 8bit
X-Trace news.albasani.net z4WpqjBQofsisvBDjQU8qJE0JucyVrKMgyUsEFrCwTk4xJCV+1Mycj1CkKReDagE8QWg1SHee09fggqZX5NORg==
NNTP-Posting-Date Wed, 1 Apr 2015 14:42:08 +0000 (UTC)
Injection-Info news.albasani.net; logging-data="gtIpJD574fYI7POWQW0Ta9s+rgln0tyjHdq8x4AI8mnfhQlbyAEeMB1eflphvh7FndIEtWcOAwymGaluJQvl/uLqTpQV0LyV0+x5RJ2k4sacGpIQhyW92S+3NKfhJyh9"; mail-complaints-to="abuse@albasani.net"
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0
In-Reply-To <parallelStream-20150401160329@ram.dialup.fu-berlin.de>
Cancel-Lock sha1:iGfPntCh0QLd2AI3LcR7lUkQ+ZA=
Xref csiph.com comp.lang.java.programmer:31435

Show key headers only | View raw


Am 01.04.2015 16:08, schrieb Stefan Ram:
>    I read somewhere that streams can be executed in parallel.
>
>    Somewhere else I read, that one needs to call
>    ».parallelStream()« for parallel execution.
>
>    So, do I get it right, that the JVM will never execute a
>    stream obtained by ».stream()« in parallel, even if it can
>    detect that this will be faster and yield the same outcome,
>    unless the programmer has explicitly enabled this via
>    ».parallelStream()«?
>
Yes. You may also use stream().parallel().

There is no place for implicit parallelism anywhere in Java. The aim in 
designing the Streams API was to make it "unobtrusive".

-- Sebastian

Back to comp.lang.java.programmer | Previous | Next | Find similar | Unroll thread


Thread

Re: .parallelStream() Sebastian <news@seyweiler.dyndns.org> - 2015-04-01 16:42 +0200

csiph-web