how can achieve without getting
error: cannot inherit final arrayset
arrayset<myobject>objectlist = new arrayset<myobject>(){ @override public boolean equals(object object) { return ((myobject)this).getid()==((myobject)object ).getid(); } };
arrayset
final class, meaning can't inherit it. trying create anonymous subclass when write
arrayset<myobject>objectlist = new arrayset<myobject>(){ @override public boolean equals(object object) { return ((myobject)this).getid()==((myobject)object ).getid(); } };
what want implement equals
(and hashcode
) myobject
:
public class myobject { ... @override public boolean equals(object other) { if (other instanceof myobject) { return getid() == ((myobject) other).getid(); } return false; } }
then, arrayset
work intend
Comments
Post a Comment