title: Linked list node pointing to nodes of different type
body: <p>This is my first post here, but I'm not new to the site (call me a lurker).
  Unfortunately this time I cannot seem to find an answer to my question without asking.
  Anyway, to the point.</p>
  
  <p>I am writing a small snakes and ladders (aka chutes and ladders) program in java for a data structures course. I had to write my own Linked List (LL) class, (I know that there is a java util that does it better, but I have to learn about the workings of the data structure) and that is not a problem. My LL is 'semi-Double linked' as I like to call it, since it links forward, but has another pointer field for other links, which is not necessarily used in every node.</p>
  
  <p>What I want to know is if it is possible to link a node from a list to another list, which is of a different type. 
  Poor example:
  (eg.) How would one link a node of type  to a node of type ? Let us say we have a LL of 7 int values [1,2,3,4,5,6,7], and a LL of 7 Strings [Monday, Tuesday, Wednesday,Thursday, Friday, Saturday, Sunday]. We want to link the node containing 1 to the node containing Monday.</p>
  
  <p>To be exact the problem I am having is as follows: 
  I have 100  nodes forward-linked, forming the game board, and a circularly linked list of 4 . I want to link the player nodes to their respective positions on the board, so that as they traverse the board, they can also follow the "snakes" and "ladders" links.</p>
  
  <p>Thanks in advance!</p>
  
  <p>My LLNode.java and LL.java are attached.</p>
  
  <pre><code>// LLNode.java  
  // node in a generic linked list class, with a link 
  
  public class LLNode&lt;T&gt; 
  {
      public T info;
      public LLNode&lt;T&gt; next, link;
  
      public LLNode()
      {   
          next = null;
          link= null;
      }
  
      public LLNode(T element)
      {
          info = element;
          next = null;
          link = null;
      }
  
      public LLNode(T element, LLNode&lt;T&gt; n)
      {
          info = element;
          next = n;
          link = null;
      }
  
      public T getInfo()
      {
          return info;
      }
  
      public void setInfo(T element)
      {
          info = element;
      }
  
      public LLNode&lt;T&gt; getNext()
      {
          return next;
      }
  
      public void setNext(LLNode&lt;T&gt; newNext)
      {
          next = newNext;
      }
  
      public LLNode&lt;T&gt; getLink()
      {
          return link;
      }
  
      public void setLink(LLNode&lt;T&gt; newLink)
      {
          link = newLink;
      }
  }
  
  // SLL.java 
  // a generic linked list class
  
  public class LL&lt;T&gt; 
  {
      private LLNode&lt;T&gt; head, tail;
      public LLNode&lt;T&gt; current = head;
  
      public LL()
      {
          head = tail = null;
      }
  
      public boolean isEmpty()
      {
          return head == tail;
      }
  
      public void setToNull()
      {
           head = tail = null;
      }
  
      public boolean isNull()
      {
          if(head == tail)
              if(head == null || tail == null)
                  return true;
              else 
                  return false;
          else 
              return false;
      }
  
      public void addToHead(T element)
      {
          head = new LLNode&lt;T&gt;(element, head);
          if (tail == null)
              tail = head;
      }
  
      public void addNodeToHead(LLNode&lt;T&gt; newNode)
      {
          head = newNode;
          if (tail == null)
              tail = head;
      }
  
      public void addToTail(T element)
      {
          if (!isNull())
          {
              tail.next= new LLNode&lt;T&gt;(element);
              tail = tail.next;
          }
          else head = tail = new LLNode&lt;T&gt;(element);
      }
  
      public void addNodeToTail(LLNode&lt;T&gt; newNode)
      {
          if (!isNull())
          {
              tail.next= newNode;
              tail = tail.next;
          }
          else head = tail = newNode;
      }
  
      public void addBefore(T element, T X)
      {
          if (!isEmpty()) // Case 1
          {
              LLNode&lt;T&gt; temp, n;
  
              temp = head;
              while( temp.next != null )
              {
                  if( temp.next.info == X )
                  {
                      n = new LLNode&lt;T&gt;(element, temp.next);
                      temp.next = n;
                      return;
                  }
                  else 
                  temp = temp.next;
              }    
          }
          else // Case 2
              head = new LLNode&lt;T&gt;(element, head);
      }
  
      public void addBefore(T element, LLNode&lt;T&gt; X)
      {
          if (!isEmpty()) // Case 1
          {
              LLNode&lt;T&gt; temp, n;
  
              temp = head;
              while( temp.next != null )
              {
                  if( temp.next == X )
                  {
                      n = new LLNode&lt;T&gt;(element, X);
                      temp.next = n;
                      return;
                  }
                  else 
                  temp = temp.next;
              }    
          }
          else // Case 2
              head = new LLNode&lt;T&gt;(element, head);
      }
  
      public T deleteFromHead()
      {
          if (isEmpty())
              return null;
          T element = head.info;
          if (head == tail)
              head = tail = null;
          else head = head.next;
          return element;
      }
  
      public T deleteFromTail()
      {
          if (isEmpty())
              return null;
          T element = tail.info;
          if (head == tail)
              head = tail = null;
          else 
          {
              LLNode&lt;T&gt; temp;
              for (temp = head; temp.next != tail; temp = temp.next);
              tail = temp;
              tail.next = null;
          }
          return element;
      }
  
      public void delete(T element)
      {
          if (!isEmpty())
              if (head == tail &amp;&amp; (element.toString()).equals(head.info.toString()))
                  head = tail = null;
              else if ((element.toString()).equals(head.info.toString()))
                  head = head.next;
          else 
          {
              LLNode&lt;T&gt; pred, temp;
              for (pred = head, temp = head.next; temp != null &amp;&amp; !((temp.info.toString()).equals(element.toString())); pred = pred.next, temp = temp.next);
              if (temp != null)
                  pred.next = temp.next;
              if  (temp == tail)
                  tail = pred;
          }
      }
  
      public void listAll()
      {
          if(isNull())
              System.out.println("\tEmpty");
          else
          {
              for ( LLNode&lt;T&gt; temp = head; temp!= tail.next; temp = temp.next)
                  System.out.println(temp.info);
          }
      }
  
      public LLNode&lt;T&gt; isInList(T element)
      {
          LLNode&lt;T&gt; temp;
          for ( temp = head; temp != null &amp;&amp; !((temp.info.toString()).equals(element.toString())); temp = temp.next);
          return temp ;
      }
  
      public LLNode&lt;T&gt; getHead()
      {
          return head;
      }
  
      public LLNode&lt;T&gt; getTail()
      {
          return tail;
      }
  
      public LLNode&lt;T&gt; getCurrent()
      {
          return current;
      }
  
      public void incrementCurrent()
      {
          current = current.next;
      }
  
      public void followCurrentLink()
      {
          current = current.link;
      }
  }
  </code></pre>