I got this class, but I can't understand how does remove function work. Why it needs to be a class name (Customer
) before remove()
, and what does it mean Customer customer = (Customer) customers.firstElement();
Can you help me?
private java.util.Vector customers = new java.util.Vector();
Server server;
void insert(AbstractEvent customer){
customers.addElement(customer);
}
/**
* @return the first customer in the queue
*/
Customer remove() {
Customer customer = (Customer) customers.firstElement();
customers.removeElementAt(0);
return customer;
}
int size() {
return customers.size();
}