title: palindrome with a stack using linked lists does not return the correct answer
body: <p>I have been implementing a Stack by using a linked list. The implementation is the following:</p>
  
  <pre><code>public class Node {
      public Object e;
      Node next;
      public Node(Object e){
          this.e=e;
      }
  }
  
  public class Stack {
      Nodo last, first;
      int count;
      public void push(Object n){
          Nodo temp=new Nodo(n);
          temp.next=last;
          last=temp;
          if (first==null){
              first=temp;
          }
          count++;
      }
      public boolean isEmpty(){
          if (count==0) return true;
          else return false;
      }
      public Object pop(){
          Object obj=null;
          if (isEmpty()){
              return -1;
          }
          else{
              obj=last.e;
              last=last.next;
          }
          count--;
          return obj;
      }
      public void print(){
          Nodo current=last;
          while (current!=null){
              System.out.println(current.e);
              current=current.next;
          }
      }
  public boolean palindrome(){
          Stack cadT1=new Stack();
          Stack cadT2=new Stack();
          cadT1=this;
          //System.out.println(this.isEmpty());
          while (this.isEmpty()!=true){
              cadT2.push(this.pop());
          }
          cadT1.print();
          while (cadT1.isEmpty()!=true){
              /*if (!(cadT1.pop().equals(cadT2.pop()))){
                  return false;
              }*/
              System.out.println(cadT1.pop()+" "+cadT2.pop());
          }
          return true;
      }
  </code></pre>
  
  <p>I have a problem with the implementation of the palindrome function, in which I am also using stacks. The problem that I have is that it always returns the value of true. I have commented the portion of the code that currently is not working. While analyzing my code I found that when I do the following assignment:</p>
  
  <pre><code>cadT1=this;
  </code></pre>
  
  <p>The cadT1 variable is still empty. I have tested this by putting the following line in the while of the palindrome function:</p>
  
  <pre><code>System.out.println(cadT1.pop()+" "+cadT2.pop());
  </code></pre>
  
  <p>and I have seen that my code does not execute that line, that is because the condition in the while loop:</p>
  
  <pre><code>while (cadT1.isEmpty()!=true){
  </code></pre>
  
  <p>is always set to false.
  The running code in my main class is the following:</p>
  
  <pre><code> Stack word=new Stack();
      word.push('a');
      word.push('s');
      word.push('d');
      word.push('f');
      System.out.println(word.palindrome());
  </code></pre>
  
  <p>What am I doing wrong? Thanks</p>