In this recipe, you are going to implement a task to update the price of a list of products. The initial task will be responsible for updating all the elements in a list. You will use a size 10 as the reference size, so if a task has to update more than 10 elements, it divides the part of the list assigned to it in two parts and creates two tasks to update the prices of the products in the respective parts.
Follow these steps to implement the example:
- Create a class named Product that will store the name and price of a product:
public class Product {
- Declare a private String attribute named name and a private double attribute named price:
private String name; private double price;
- Implement getter and setter methods ...