我必须只向ArrayList. 我怎样才能equals为此目的覆盖该方法?我想要类似的东西:
public boolean equals (Object in) {
    if(in == null) {
        return false;
    }
    else if(in instanceof UniqueFruits) {
        // ?? check whether the newly added element exists or not           
        return true;
    }
    else {
        return false;
    }       
} 
如何检查新添加的元素是否存在?我必须检查水果名称。