![]() ![]() | ListApplication.java - Liste applikationen repræsenteret ved klassen ListApplication. | Lecture 5 - slide 27 : 28 Program 2 |
public static void main(String[] args){ LinkedList lst = new LinkedList(); Integer element; lst.insertFirst(new Integer(1)); lst.insertFirst(new Integer(2)); lst.insertFirst(new Integer(3)); lst.deleteFirst(); lst.insertFirst(new Integer(4)); LinkedList.Linkable link = lst.firstLinkable(); while (link != null){ element = (Integer)link.data(); System.out.println(element); link = link.next(); } System.out.println("Listen har nu " + lst.length() + " elementer"); } //main |