Nested stream to check the truth condition at first instance Lets say I have  Cars with Features, and I have been given a List of features to look for in the Cars available with me. Though I could have done that using for-loop, what are the suggestions for below? Is this production-worthy?

import java.util.Arrays;
import java.util.List;

import org.apache.commons.collections4.CollectionUtils;

public class LookupTest {

    public static void main(String[] args) {
        Feature ft11 = new Feature(1);
        Feature ft12 = new Feature(2);
        Feature ft13 = new Feature(4);
        Car fer = new Car("Ferrari", ft11, ft12, ft13);

        Feature ft21 = new Feature(1);
        Feature ft22 = new Feature(2);
        Feature ft23 = new Feature(8);
        Car suz = new Car("Suzuki", ft21, ft22, ft23);

        List&lt;Car&gt; cars = Arrays.asList(fer, suz);
        List&lt;Integer&gt; lookForTypes = Arrays.asList(4); // look whether any car has feature-type 4

        if (CollectionUtils.isNotEmpty(lookForTypes)) {
            /* code block in question : start */
            boolean atLeastOneTypeFound = cars
                    .parallelStream()
                    .anyMatch(holding -&gt; holding.getAmounts()
                            .parallelStream()
                            .anyMatch(feature -&gt; {
                                return lookForTypes.contains(feature.type);
                            }));
            /* code block in question : end */    
            System.out.println("atLeastOneTypeFound=" + atLeastOneTypeFound);
        }
    }
}

class Car {
    List&lt;Feature&gt; featureList;
    String name;

    public Car(String name, Feature... features) {
        featureList = Arrays.asList(features);
        this.name = name;
    }

    public List&lt;Feature&gt; getAmounts() {
        return featureList;
    }

    public String getName() {
        return name;
    }
}

class Feature {
    int type;

    public Feature(int type) {
        this.type = type;
    }

    public int getType() {
        return type;
    }
}
If you don't need the Car, you can also flatMap to have the features and then distinct them before searching.

cars.stream()
  .flatMap(car -&gt; car.getAmounts().stream())
  .map(Feature::getType)
  .distinct() // As spotted by @Pimgd in the comments this is useless
  .anyMatch(lookForTypes::contains);


But if you want to improve the readability of your code you should better consider to move a part of this "logic" into your objects :

cars.stream()
  .anyMatch(car -&gt; car.hasAtLeastOneFeature(lookForTypes);

// ...

Car {
  boolean hasAtLeastOneFeature(List&lt;Integer&gt; features) {
    // Note that I renamed getAmounts to getFeatures
    return getFeatures().stream()
      .anyMatch(feature -&gt; features.contains(feature.getType());
  }
}