List of usage examples for java.util OptionalDouble orElse
public double orElse(double other)
From source file:com.devnexus.ting.model.CfpSubmission.java
public Double getRating() { final List<Integer> ratings = new ArrayList<>(); for (CfpSubmissionReview review : this.cfpSubmissionReviews) { ratings.add(review.getRating()); }/* w w w. ja v a2 s . com*/ OptionalDouble averageRating = ratings.stream().mapToDouble(a -> a).average(); return averageRating.orElse(0d); }