//specify type variables for the class //F is the type of the fist item //S is the type of the second public class Association { private F first; private S second; public Association(F item1, S item2){ first = item1; second = item2; //can't do this //F other = new F(); //can't cast something to F or S //F item = (F)someObject //F[] data = new F[10]; //variable instanceof F //boolean b2 = item1 instanceof S; //can do this, but won't //boolean b = item1 instanceof Integer; } public F getFirst(){ return first; } public S getSecond(){ return second; } public void setFirst(F item){ first = item; } public void setSecond(S item){ second = item; } //use a wildcard for the type ? public boolean equals(Association a){ System.out.println("Equals called"); return first.equals(a.getFirst()) && second.equals(a.getSecond()); } }