Ejemplo n.º 1
0
        public No retiraPrimeiro()
        {
            if (this.vazia())
            {
                throw new Exception
                          ("Erro : Lista vazia");
            }
            Celula aux  = this.Primeiro;
            Celula q    = aux.prox;
            No     item = q.item; aux.prox = q.prox;

            if (aux.prox == null)
            {
                this.ultimo = aux;
            }
            return(item);
        }
Ejemplo n.º 2
0
        public No pesquisa(No chave)
        {
            if (this.vazia() || chave == null)
            {
                return(null);
            }
            Celula aux = this.Primeiro;

            while (aux.prox != null)
            {
                if (aux.prox.item.equals(chave))
                {
                    return(aux.prox.item);
                }
                aux = aux.prox;
            }
            return(null);
        }