OK, das ist meine Klasse, es kapselt ein Objekt und delegiert gleich und String an dieses Objekt, warum kann ich keine Instanz von ???Generics und instanceof - Java
public class Leaf<L>
{
private L object;
/**
* @return the object
*/
public L getObject() {
return object;
}
/**
* @param object the object to set
*/
public void setObject(L object) {
this.object = object;
}
public boolean equals(Object other)
{
if(other instanceof Leaf<L>) //--->ERROR ON THIS LINE
{
Leaf<L> o = (Leaf<L>) other;
return this.getObject().equals(o.getObject());
}
return false;
}
public String toString()
{
return object.toString();
}
}
wie kann ich das zum arbeiten bekommen ?? Danke!
vielleicht meinen Sie nicht Instanceof – dimitrisli