I have a set and a method:
private static Set<String> set = ...;
public static String method(){
    final String returnVal[] = new String[1];
    set.forEach((String str) -> {
        returnVal[0] += str;
        //if something: goto mark
    });
    //mark
    return returnVal[0];
}
Can I terminate the forEach inside the lambda (with or without using exceptions)? Should I use an anonymous class?
I could do this:
set.forEach((String str) -> {
     if(someConditions()){
         returnVal[0] += str;
     }
});
but it wastes time.
implementation using stream.reduce
return set.parallelStream().reduce((output, next) -> {
    return someConditions() ? next : output;
}).get(); //should avoid empty set before
I am looking for the fastest solution so exception and a 'real' for each loop are acceptable if they are fast enough.
 
    