23 lines
497 B
Java
23 lines
497 B
Java
|
|
||
|
|
||
|
import java.util.LinkedList;
|
||
|
|
||
|
public class TrashCollection <T extends DrawingCruiser>{
|
||
|
LinkedList<T> linkedList;
|
||
|
|
||
|
public TrashCollection(){
|
||
|
linkedList = new LinkedList<>();
|
||
|
}
|
||
|
public void Add(T car){
|
||
|
linkedList.add(car);
|
||
|
}
|
||
|
public void PopHead(){
|
||
|
if(linkedList.size() ==0)
|
||
|
return;
|
||
|
linkedList.remove();
|
||
|
}
|
||
|
public T GetLast(){
|
||
|
return linkedList.getFirst();
|
||
|
}
|
||
|
public int GetSize(){return linkedList.size();}
|
||
|
}
|