I want to iterate a list in a specify order using the Interface Iterator. In this case, I want to iterate the list (listofproducts) in descending product.prize order.
public class Invoice {
private static int static_id;
private int id;
private String date;
private List<Product> listofproduct = new ArrayList<Product>();
private boolean open;
}
public class Product {
private static int count = 0;
private int code;
private String name;
private String description;
private double price;
}
I have a public method to get the price. How can I solve this?