/** * This class contains the linked list. * It also contains the constructor, wich * generates a new list called myList * * @author Christian Ohlsson, Karlstad university 1999 * @version 1.0.0 */ public class List { Element first, last; /** * This is the constructor of the list. * What it basically do is to set * the two Elements constructed before * to null. */ public List() { first = last = null; } /** * This function returns the first Element * in the list. */ public Element first() { return first; } /** * This function returns the last Element * in the list. */ public Element last() { return last; } /** * If the first element in the List is null, * it returns true, that is, there's no Elements * in the List. */ public boolean empty() { return first==null; } /** * This function recives a number and it traverses * though the List until that number is reached * and then returns the Element on that location */ public Element getElement(int number) { Element e = first; int antal = 0; while (antal