in the example that follows example suppose certain flight is fully booked an hour prior to departure because of the possibility of cancellationsthe airline maintains priority queue of standby passengers hoping to get seat the priority of each standby passenger is determined by the airline taking into account the fare paidthe frequent-flyer statusand the time that the passenger is inserted into the priority queue standby passenger reference is inserted into the priority queue with an insert operation as soon as he or she requests to fly standby shortly before the flight departureif seats become available (for exampledue to noshows or last-minute cancellations)the airline removes standby passenger with first priority from the priority queueusing aremovemin operation and lets this person board this process is then repeated until all available seats have been filled or the priority queue becomes empty entries and comparators there are still two important issues that we have left undetermined to this pointhow do we keep track of the associations between keys and valueshow do we compare keys so as to determine smallest keyanswering these questions involves the use of two interesting design patterns the definition of priority queue implicitly makes use of two special kinds of objects that answer the above questionsthe entry and comparatorwhich we discuss in this subsection entries an entry is an association between key and value xthat isan entry is simply key-value pair we use entries in priority queue to keep track of the way is associating keys and their corresponding values an entry is actually an example of more general object-oriented design patternthe composition patternwhich defines single object that is composed of other objects we use this pattern in priority queue when we define the entries being stored in the priority queue to be pairs consisting of key and value pair is the simplest compositionfor it combines two objects into single pair object to implement this conceptwe define class that stores two objects in its first and second instance variablesrespectivelyand provides methods to access and update these variables in code fragment we show an implementation of the composition pattern for entries storing key-value pairs in priority queue we realize this composition with an interface called entry (the java util