/* * Elenco.java * * Created on March 6, 2006, 5:20 PM * * To change this template, choose Tools | Options and locate the template under * the Source Creation and Management node. Right-click the template and choose * Open. You can then make changes to the template in the Source Editor. */ /** * * @author gabriele */ package javatemplate; import java.util.*; public class Elenco { private LinkedList l=new LinkedList(); //attributo public Elenco() { } //costruttore public void push(T x) { l.addFirst(x); } public T top(){return l.getFirst(); } public void pop(){l.removeFirst(); } public void print(){ Iterator iterator = l.iterator(); while(iterator.hasNext()) System.out.print(iterator.next().toString());} }