public static <E>ForkJoinTask<E> forEach(Collection<E> list,Predicate<E> operation){
  if (list.size() > 0) {
    @SuppressWarnings("unchecked") E[] objects=list.toArray((E[])new Object[list.size()]);
    CountedCompleter<E> completer=new ForEach<E>(null,operation,0,objects.length,objects);
    return completer;
  }
  return null;
}

public static < E > ForkJoinTask < E > forEach ( Collection < E > list , Predicate < E > operation ) { if ( list . size ( ) > 0 ) { @ SuppressWarnings ( "unchecked" ) E [ ] objects = list . toArray ( ( E [ ] ) new Object [ list . size ( ) ] ) ; CountedCompleter < E > completer = new ForEach < E > ( null , operation , 0 , objects . length , objects ) ; return completer ; } return null ; }
calls predicate for each element in the collection asynchronously . utilizes fork / join framework to speed up processing , by using a divide / conquer algorithm
