PIbd-23_Panina_A.D.Cruiser..../TrashCollection.java

23 lines
497 B
Java
Raw Normal View History

2023-12-23 16:20:46 +04:00
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();}
}