I am porting a C++ library to Java and I need a heap data structure. Is there a standard implementation or will I need to do it myself?
Min heap:
PriorityQueue minHeap = new PriorityQueue();
Max heap:
PriorityQueue maxHeap = new PriorityQueue(new Comparator() { @Override public int compare(Integer o1, Integer o2) { return - Integer.compare(o1, o2); } });