public override string ToString()
        {
            if (this.Vazia())
            {
                return(null);
            }

            StringBuilder auxImpr = new StringBuilder();
            Elemento      aux     = this.prim.prox;

            while (aux != null)
            {
                auxImpr.AppendLine(aux.ToString());
                aux = aux.prox;
            }

            return(auxImpr.ToString());
        }
        public IDado Retirar()
        {
            if (this.Vazia())
            {
                return(null);
            }

            Elemento aux = this.prim.prox;

            this.prim.prox = aux.prox;
            if (aux.prox != null)
            {
                aux.prox = null;
            }
            else
            {
                this.ult = this.prim;
            }

            return(aux.dado);
        }
Exemple #3
0
 /// <summary>
 /// Construtor do Objeto Elemento, esta classe serve para acessar os dados internos do objeto
 /// </summary>
 /// <param name="dado">Dados do objeto</param>
 public Elemento(Dados dado)
 {
     this.d    = dado;
     this.prox = null;
 }
 /// <summary>
 /// Construtor. Cria uma lista vazia com sentinela.
 /// </summary>
 public Lista()
 {
     this.prim = new Elemento(null);
     this.ult  = this.prim;
 }