why if I write this:
Node<Vertex<E>, Double> a = queue.extractMax();
Vertex<E> u = a.getValue();
The code compile without errors and if I write this:
Vertex<E> u = queue.extractMax().getValue();
I got the error:
error: incompatible types: Object cannot be converted to Vertex
Assuming your extractMax()
signature/return type is different from Node<Vertex<E>, Double>
-
Vertex<E> u = ((Node<Vertex<E>, Double>) queue.extractMax()).getValue();
This one should definitely work according your example.