title: How to Fix an Enqueue and Dequeue Issue in Code?
body: <p>I am working on this project to solve a maze using a queue in Java. As I was working on the main class, I am getting errors specically in the enqueue and dequeue methods. </p>
  
  <pre><code>public void mazeSolver(int startRow, int startCol, int endRow, int endCol) { 
      Location location = new Location();
      location.setPosition(startRow, startCol);
      LocationQueue queue = new LocationQueue();
      queue.enqueue(location);
      while (!queue.isEmpty()) {
          location = queue.dequeue();
          mazeArray[location.getRow()][location.getColumn()] = '.';
          if ((location.getRow() == endRow &amp;&amp; location.getColumn() == endCol)) {
              break;
          }
          if (location.getRow() + 1 &lt; Rows) {
              if (mazeArray[location.getRow() + 1][location.getColumn()] == ' ') {
                  Location newLocation = new Location();
                  newLocation.setPosition(location.getRow() + 1, location.getColumn());
                  queue.enqueue(newLocation);
              }
          }
          if (location.getRow() - 1 &gt;= 0) {
              if (mazeArray[location.getRow() - 1][location.getColumn()] == ' ') {
                  Location newLocation = new Location();
                  newLocation.setPosition(location.getRow() - 1, location.getColumn());
                  queue.enqueue(newLocation);
              }
          }
          if (location.getColumn() + 1 &lt; Columns) {
              if (mazeArray[location.getRow()][location.getColumn() + 1] == ' ') {
                  Location newLocation = new Location();
                  newLocation.setPosition(location.getRow(), location.getColumn() + 1);
                  queue.enqueue(newLocation);
              }
          }
          if (location.getColumn() - 1 &gt; 0) {
              if (mazeArray[location.getRow()][location.getColumn() - 1] == ' ') {
                  Location newLocation = new Location();
                  newLocation.setPosition(location.getRow(), location.getColumn() - 1);
                  queue.enqueue(newLocation);
              }
          }
      }
  }
  </code></pre>
  
  <p>I have a LocationQueue class which involves the enqueue and dequeue methods:</p>
  
  <pre><code>public class LocationQueue&lt;Location&gt; {
  
  LinkList locationList = new LinkList();
  
  public void enqueue(int iData) {
      locationList.addLast(iData);
  }
  
  public Node dequeue() {
      if (!locationList.isEmpty()) {
          return locationList.deleteFirst();
      } else {
          return null;
      }
  }
  
  public void displayQueue() {
      locationList.displayList();
      System.out.println();
  }
  
  public boolean isEmpty() {
      return locationList.isEmpty();
  }
  }
  </code></pre>
  
  <p>And this is my Node class:</p>
  
  <pre><code>public class Node  {
  int iData;
  Node next;
  
  public Node (int values) {
      iData = values;
      next = null;
  }
  
    public void displayNode(){
          System.out.print(iData + " ");
      }
  }
  </code></pre>
  
  <p>This issue may be a simple fix and I haven't catch where I'm doing it wrong. Since the error is stating "The method enqueue(int) in the type LocationQueue is not applicable for the arguments (Location)" and "Type mismatch: cannot convert from Node to Location". I'm just unsure what section of the code I need to change. My Location and LinkList class may be irrelevant to post in this issue, however if you would like to see both classes I wouldn't mind posting it. </p>
  
  <p>Note: If my format of the code looks a bit off, my apologies. I'm still getting used to formatting the code on StackOverflow.</p>