我有一個對象具有與該對象關聯的5種不同整數類型的對象。像這樣:java arraylist在對象上包含類型
public class Edge implements Comparable {
int weight, tox, toy, fromx, fromy;
public Edge(int x1, int y1, int x2, int y2, int wei) {
tox = x1;
toy = y1;
fromx = x2;
fromy = y2;
weight = wei;
}
public int compareTo(Object obj) {
我要讓這些OBJ文件的ArrayList,然後調用包含在名單上看到,如果任意整數處於或者列表中的任何一種數據類型,edge.tox edge.toy edge.fromx或edge.fromy ....有沒有辦法做到這一點?
感謝你在先進
等等,你想要一個'列表'或列表'? –
durron597
2013-04-24 21:16:24