public class state implements Comparator<state>{
Point a;
Point b;
private int path_cost=0;
...
}
class Point {
int x;
int y;
...
}
上面我有:包含功能链表
PriorityQueue<state> openNode= new PriorityQueue<state>();
LinkedList<state> closed =new LinkedList<state>();
state currNode;
我需要检查是否有openNode
或closed
的Point a
等于currNode
的Point a
。
我可以使用contains
如果我必须匹配整个对象,但在这里我只关心一个状态类的变量(点a)。我想要的方法来检查PriorityQueue和LinkedList中的所有节点。
另外: 我想在我的priorityQueue和LinkedList上使用Iterator。但我不知道如何使用Iterator读取Point a的值。
您需要编写一个。你有问题吗? –
我不能想到一个方法来做到上述! – change