我在創建一個包含'Vertex3 <T>'的實例的Set。我在與行的問題一點點創建的集:在java中模板cals的設置
public Set<Vertex3<Integer>> verticies = new Set<Vertex3<Integer>>();
Eclipse是強調在紅色的「設置」部分等號的右邊,並顯示錯誤消息「不能實例化type Set < Vertex3 <Integer> >「。
'Vertex3 <Ť>' 被定義爲如下:
public class Vertex3 <T> {
public T x;
public T y;
public T z;
public Vertex3() {
// do nothing
}
public Vertex3(T x, T y, T z) {
this.x = x;
this.y = y;
this.z = z;
}
public Vertex3(T x, T y) {
this.x = x;
this.y = y;
}
}
可以提供理解任何幫助。
所有的答案都是正確的 - 你可能想從你的類型判斷一個HashSet。 –