java - Stream of boolean values, is any true? -


I want to parallel the code given below using parallel stream:

  Boolean anyTrue () {For (Element E: set off) {if (eval (e)) {Back true; } } return false; }   

Will the following tasks and regular short-circuit evaluation be used on parallel streams?

  setOfE.parallelStream (). Map (e -> gt; eval (e)). Less (false, (A, B) -> A )    

< P> The Stream API is actually the first class support for your requirement:
  setOfE.parallelStream (). Any match (e-> eval (e)); Unlike your approach with   

reduce , short-circuit evaluation and compatibility is guaranteed to be equally leverage.

Comments

Popular posts from this blog

Out of index C/C++ -

regex - PatternSyntaxException: while using String.ReplaceAll function in java? -

java - Projects which are accessed via multiple (different) IDEs: Ant or Maven? -