java doubt priority queue

priority queue can be used to maintain a min heap or a max heap and i can use it for integers,
but in certain places i am finding that based on the question i need to use priority queue , but then i have to put the things into the priority queue based on certain fiels or like there are several fields for a certain question like character,int data and i have to put the thing into the priority queue based on the character and not based on the int data , and at the same time i have to acces both the character and the data and the pq must be based on the character ,how will i implement this ,
if its like just no. i can do
priorityQueue<Integer> pq = new PriorityQueue<>()
but here i donno how to do ,should i create a classs like and put inside the priority queue , how will i compare that particular field of that class and put inside,
THANK YOU !!!

Comments (1)