title: Can you use one method to add items to 3 different implementations of a Priority Queue?
body: <p>I am doing an assignment for University which involves custom implementations of a Priority Queue. Each item in the queue will be a <code>Node&lt;E&gt;</code> storing the element and its priority (E, p). The overall field is meant to be of type <code>ArrayList&lt;Node&lt;?&gt;&gt;</code> and the 3 Implementations will be an -</p>
  
  <ul>
  <li><p>unsorted queue with items being added on the end, and removed by the highest priority which has been on the queue for longest - type <code>ArrayList&lt;Node&lt;String&gt;&gt;</code></p></li>
  <li><p>sorted queue with items being removed from the front of the queue and added before the first item of the next lowest priority - so something of priority 2 will be added between the items of priority 1 and 3. -  type <code>ArrayList&lt;Node&lt;String&gt;&gt;</code></p></li>
  <li><p>A sorted queue of Queues where each Node element is an array list of items with the same priority  -  type <code>ArrayList&lt;Node&lt;ArrayList&lt;String&gt;&gt;&gt;</code></p></li>
  </ul>
  
  <p>Each with their own enqueue, dequeue etc methods. </p>
  
  <p>I was wondering if I could define a single method which will work with all three implementations of the Priority Queue as they correspond to the same field in the Application, and the respective enqueue methods of the queue types being called depending on the definition of the field. </p>