Exercise: The Cargo Load Balancer
Explore how to implement a method that calculates a cargo ship's total stability by filtering null and empty containers, mapping container moments, and reducing them to a sum using the Java Stream API. This lesson strengthens your skills in functional programming by applying stream operations to real-world problems.
We'll cover the following...
We'll cover the following...
Problem statement
A cargo ship’s stability is determined by its “Total Moment.” The moment of a single container is calculated as its