title: How to check if a doubly-linked list is properly linked in java?
body: <p>I'm implementing an abstract data type for lists of <code>Coin</code> objects.
  This should be a Doubly-Linked-List</p>
  
  <p>These are the fields: </p>
  
  <pre><code>private Coin prev, next; 
  private Card head, tail;
  private int size;
  </code></pre>
  
  <p>Now, my question is how can I check if the coins are properly linked up in a doubly-linked list.</p>
  
  <p>coondition to check for:</p>
  
  <ul>
  <li>starting from head, and going through all the elements of the list check if each has a next element/coin.
  
  <ul>
  <li>if yes, does that next have a previous? 
  
  <ul>
  <li>if yes, then it is not null, and must be x. Then, increase x</li>
  <li>if no, then that's not good!</li>
  </ul></li>
  <li>if no(/if there is no next element)...
  
  <ul>
  <li>check if length is 1
  
  <ul>
  <li>if it is 1, then that,s good!</li>
  <li>if other, then it is bad!</li>
  </ul></li>
  </ul></li>
  </ul></li>
  </ul>
  
  <p>(All of this should be inside a boolean method with no parameters). This method is just checking if the list is in correct linking format(Doubly linked list)</p>
  
  <p>(This is not a homework question)</p>