Код работает корректно,почему не проходит?
/*
Множество всех животных
*/

public class Solution {
    public static void main(String[] args) {
        Set<Cat> cats = createCats();
        Set<Dog> dogs = createDogs();

        Set<Object> pets = join(cats, dogs);
        printPets(pets);

        removeCats(pets, cats);
        printPets(pets);
    }

    public static Set<Cat> createCats() {
        HashSet<Cat> result = new HashSet<Cat>();
        for(int i=0;i<4;i++){
            result.add(new Cat());
        }

        return result;
    }

    public static Set<Dog> createDogs() {
        HashSet<Dog> dog = new HashSet<>();
        for(int i=0;i<3;i++){
            dog.add(new Dog());
        }
        return dog;
    }

    public static Set<Object> join(Set<Cat> cats, Set<Dog> dogs) {
       HashSet<Object>res = new HashSet<>();
        Collections.addAll(res,dogs,cats);

        return res;
    }

    public static void removeCats(Set<Object> pets, Set<Cat> cats) {
        Iterator<Object> it= pets.iterator();
        while (it.hasNext()){
            if((it.next()).equals(cats)){
                it.remove();
            }
        }
    }

    public static void printPets(Set<Object> pets) {
        for (Object txt :
                pets) {
            System.out.println(txt);
        }
    }

    public static class Dog{

    }
    public static class Cat{

    }
}