class Category {

    @Override
    public boolean equals(Object category) {
        if (category instanceof Category) {
            Category cat = (Category) category;
            return this.getName() == null ?
                    cat.getName() == null :
                    this.getName().equalsIgnoreCase(cat.getName());
        } else {
            return false;
        }
    }

}