View difference between Paste ID: 1gyPEDAd and gzpZWYQj
SHOW: | | - or go back to the newest paste.
1-
// Retorna o nodo que antecede um dado nodo. 
1+
// Adiciona um dado nodo no início
2-
// Gera erro se "node" é o cabeçalho.
2+
public void addFirst(DNode v) {
3-
public DNode getPrevious(DNode node)
3+
    DNode w = getNext(this.header);
4-
        throws IllegalArgumentException {
4+
    v.setNext(w);
5-
    if (node == this.header) {
5+
    v.setPrevious(this.header);
6-
        throw new IllegalArgumentException("Este elemento é o nodo "
6+
    w.setPrevious(v);
7-
                + "header e não há nenhum outro nodo anterior a ele");
7+
    this.header.setNext(v);
8-
    }
8+
    this.size++;
9-
    return node.getPrevious();
9+