I want to store all long
type integer to a priority queue, and I want to intialize the queue something like this
PriorityQueue<long> pQueue = new PriorityQueue<>();
Is there an alternative available in java collections to achieve something like this?
CodePudding user response:
Java doesn't allow primitive types in generics. You must use wrapper class like below.
PriorityQueue<Long> pQueue = new PriorityQueue<>();