compositions include tripleswhich store three objectsquadrupleswhich store four objectsand so on code fragment java interface for an entry storing key-value pairs in priority queue comparators another important issue in the priority queue adt that we need to define is how to specify the total order relation for comparing keys we have number of design choices concerning how to compare keys that we can make at this point one possibilityand the one that is the most concreteis to implement different priority queue for each key type we want to use and each possible way of comparing keys of such types the problem with this approach is that it is not very general and it requires that we create lot of similar code an alternative strategy is to require that keys be able to compare themselves to one another this solution allows us to write general priority queue class that can store instances of key class that implements some kind of comparable interface and encapsulates all the usual comparison methods this solution is an improvement over the specialized approachfor it allows us to write single priority queue class that can handle lots of different types of keys but there are contexts in which this solution is asking too much of the keysas keys often do not "knowhow they ought to be compared two examples follow example given keys and we have that < if the keys are integer objects (to be compared in the usual manner)but < if the keys are string objects (to be compared lexicographicallyexample geometric algorithm may compare points and in the planeby their -coordinate (that isp <= ifx( < ( ))to sort them from left to rightwhile another algorithm may compare them by their -coordinate (that isp < ify( < ( ))to sort them from bottom to top in principlethere is nothing pertaining to the concept of point that says whether points should be compared