I don't know how to describe the goal I want to achieve with a good title. I have a list of objects where each have a boolean member. I want to filter this list to get at the end the first objects from the list which all have this boolean member set to true.
This is how I would do it without streams, add every object to a new list for which the getter method returns true and stop when the first element returns false.
int i = 0;
while(i < list.size()){
if(!list.get(i).isMemberTrue()){
break;
}
else{
newList.add(list.get(i));
}
i++;
}
Is this somehow possible with a sequential stream?