📄 sales.java
字号:
import java.util.*;
/**
* Maintains a list of the orders that have been completed. Contains a
* collection of {@link Order} objects.
*
* @author Libo Du
* @version 1.0.0
* @see Order
*/
public class Sales implements Iterable<Order>{
/* Collection of <code>Order</code> objects.*/
private ArrayList<Order> orders;
/**
* Constructs an collection <code>orders</code>, which is initially empty.
*/
public Sales(){
orders = new ArrayList<Order>();
}
/**
* Add the specified {@link Order} to the collection <code>orders</code>.
*
* @param order the specified {@link Order} object.
*/
public void addOrder(Order order){
orders.add(order);
}
/**
* Returns an iterator over the instances in the collection <code>orders</code>.
*
* @return an {@link Iterator} of {@link Order}
*/
public Iterator<Order> iterator(){
return orders.iterator();
}
/**
* Returns the number of instances in the collection <code>orders</code>.
*
* @return the number of {@link Order} objects in this sale.
*/
public int getNumberOfOrders(){
return orders.size();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -