Can someone explain me this snippet of code?
{
// Comparator lambda function that enables the priority queue to store the nodes
// based on the cost in the ascending order.
Comparator<NodeCost> NodeCostComparator = (obj1, obj2) -> Integer.compare(obj1.cost, obj2.cost);
// Priority queue stores the object node-cost into the queue with
// the smallest cost node at the top.
PriorityQueue<NodeCost> pq = new PriorityQueue<>(NodeCostComparator);
// The cost of the source node to itself is 0
pq.add(new NodeCost(source_node, 0));