Class AbstractPriorityQueue.PQEntry<K,V>

java.lang.Object
com.zybooks.dsaj.pq.AbstractPriorityQueue.PQEntry<K,V>
Type Parameters:
K - The key type (keys must be unique and comparable)
V - The value type stored with each entry
All Implemented Interfaces:
Entry<K,V>
Direct Known Subclasses:
HeapAdaptablePriorityQueue.AdaptablePQEntry
Enclosing class:
AbstractPriorityQueue<K,V>

protected static class AbstractPriorityQueue.PQEntry<K,V> extends Object implements Entry<K,V>
A concrete implementation of the Entry interface to be used within a PriorityQueue implementation.
  • Constructor Details

    • PQEntry

      public PQEntry(K key, V value)
      Creates a new PQEntry
      Parameters:
      key - The new entry's key
      value - The new entry's value
  • Method Details

    • getKey

      public K getKey()
      Return the entry's key
      Specified by:
      getKey in interface Entry<K,V>
      Returns:
      the entry's key
    • getValue

      public V getValue()
      Return the entry's value
      Specified by:
      getValue in interface Entry<K,V>
      Returns:
      the entry's value
    • setKey

      protected void setKey(K key)
      Set the entry's key
      Parameters:
      key - the new key
    • setValue

      protected void setValue(V value)
      Set the entry's value
      Parameters:
      value - the new value