Advertisement
mark79

Movie Database : Data Structures Fundamentals with Java - Retake Exam - 18 December 2022

Dec 22nd, 2022
669
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.50 KB | None | 0 0
  1.     @Override
  2.     public Iterable<Movie> getMoviesOrderedByBudgetThenByRating() {
  3.         return this.movies
  4.                 .stream()
  5.                 .sorted((o1, o2) -> {
  6.                     if (Double.compare(o2.getBudget(), o1.getBudget()) == 0) {
  7.                         return Double.compare(o2.getRating(), o1.getRating());
  8.                     }
  9.                     return Double.compare(o2.getBudget(), o1.getRating());
  10.                 })
  11.                 .collect(Collectors.toList());
  12.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement