public void output() {
        ListElement current = head;
        while (current != tail.next()) {
            System.out.print(current.getValue() + " ");
            current = current.next();
        }
        System.out.println();
    }