title: How does one compare two linked lists nodes in Java?
body: <p>I am trying to write a searching algorithm to check one node in a linked integer list vs another node in that same list.</p>
  
  <p>I think there seems to be a problem with the IF statement (data is in the list):</p>
  
  <pre><code>   LinkedList&lt;Integer&gt; listScore = new LinkedList&lt;Integer&gt;();
     int temp = 0;
     String temp2 = "";
     boolean flag = true;
     while (flag){
     flag = false;
     for (int j = 0; j &lt; linebr; j++){
       if (listScore(j) &lt; listScore(j+1)){
          System.out.println("Testing");
       }
  }
  </code></pre>
  
  <p>I did originally try listScore[j] but I think there is something wrong with the way I have written it. Any help or explanation as to why it doesent work would be Greatly appreciated!!</p>