0

オブジェクトに関連付けられた 5 つの異なる整数型を持つオブジェクト Edges があります。このような:

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 を作成し、次にリストで contains を呼び出して、任意の整数がこれらのデータ型、edge.tox、edge.toy、edge.fromx または edge.fromy のいずれかのリストにあるかどうかを確認したいと考えています. これを行う方法はありますか?

よろしくお願いします

4

2 に答える 2