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


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

Re: .parallelStream()

From Sebastian <news@seyweiler.dyndns.org>
Newsgroups comp.lang.java.programmer
Subject Re: .parallelStream()
Date 2015-04-01 16:42 +0200
Organization albasani.net
Message-ID <mfh040$icm$1@news.albasani.net> (permalink)
References <parallelStream-20150401160329@ram.dialup.fu-berlin.de>

Show all headers | 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