title: Exposing the node class and retain a reference to it in another class
body: <p>I am looking for way to have my minecart objects act as a node so they can remove themselves from a list, but I fear that the current code design is causing troubles to allow this.</p>
  <p>I think its because of the different types: <code>&lt;T extends MineCart&gt;</code> vs <code>&lt;MineCart&gt;</code>.<br><br>
  I am not looking for an answer on how to write the remove method, but rather look for a solution so a MineCart object can act like a node.
  I would appreciate to get some advice on how to solve this problem.</p>
  <p>Linkedlist (only the relevant part is shown)</p>
  <pre><code>public class MyCustomLinkedList&lt;T extends MineCart&gt; implements Iterable&lt;T&gt; {
  
      //... your typical list methods (e.g. add/remove etc)
  
      public static class Node&lt;T&gt; {
          private T item;
          private Node&lt;T&gt; prev, next;
  
          public Node(T item, Node&lt;T&gt; prev, Node&lt;T&gt; next) {
              this.item = item;
              this.prev = prev;
              this.next = next;
          }
      }
  }
  </code></pre>
  <p>MineCart class (only the relevant part is shown)</p>
  <pre><code>public abstract class MineCart implements Comparable&lt;MineCart&gt; {
      public MineCart nextCart; 
      public MineCart prevCart;
  
      public MineCart getNextMineCart() {
         // and then do something like this:
         // return this.next;
         // or return nextCart;
      }
  }
  </code></pre>